Skip to content

Commit

Permalink
Adding manual resizing to TM metadata accounts.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Sep 10, 2024
1 parent 4e913b5 commit a893b18
Show file tree
Hide file tree
Showing 19 changed files with 321 additions and 284 deletions.
104 changes: 52 additions & 52 deletions auction-house/program/Cargo.lock

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions auction-house/program/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use anchor_lang::{
};
use anchor_spl::token::{Mint, Token, TokenAccount};
use arrayref::array_ref;
use mpl_token_metadata::state::{Metadata, TokenMetadataAccount};
use mpl_token_metadata::state::Metadata;
use spl_token::{instruction::initialize_account2, state::Account as SplAccount};
use std::{convert::TryInto, slice::Iter};

Expand Down Expand Up @@ -379,7 +379,12 @@ pub fn pay_creator_fees<'a>(
size: u64,
is_native: bool,
) -> Result<u64> {
let metadata = Metadata::from_account_info(metadata_info)?;
let data = &metadata_info.data.borrow_mut();
if metadata_info.data_is_empty() || data[0] != mpl_token_metadata::state::Key::MetadataV1 as u8
{
return Err(AuctionHouseError::MetadataDoesntExist.into());
}
let metadata = Metadata::deserialize(&mut data.as_ref())?;
let fees = metadata.data.seller_fee_basis_points;
let total_fee = (fees as u128)
.checked_mul(size as u128)
Expand Down
Loading

0 comments on commit a893b18

Please sign in to comment.