From 42864c213e181a0603140a6da92fb07894f392bc Mon Sep 17 00:00:00 2001 From: JeremyLi28 Date: Wed, 20 Nov 2024 11:34:13 -0800 Subject: [PATCH] clean up unused parameters --- .../instructions/cnft/sol_cnft_fulfill_buy.rs | 5 ---- programs/mmm/src/util.rs | 7 +---- sdk/src/idl/mmm.ts | 26 ------------------- tests/mmm-cnft.spec.ts | 6 ----- 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/programs/mmm/src/instructions/cnft/sol_cnft_fulfill_buy.rs b/programs/mmm/src/instructions/cnft/sol_cnft_fulfill_buy.rs index db8614f..45265fa 100644 --- a/programs/mmm/src/instructions/cnft/sol_cnft_fulfill_buy.rs +++ b/programs/mmm/src/instructions/cnft/sol_cnft_fulfill_buy.rs @@ -24,9 +24,6 @@ pub struct SolCnftFulfillBuyArgs { // === cNFT transfer args === // // The Merkle root for the tree. Can be retrieved from off-chain data store. root: [u8; 32], - // The Keccak256 hash of the NFTs existing metadata (without the verified flag for the creator changed). - // The metadata is retrieved from off-chain data store. - metadata_hash: [u8; 32], // The Keccak256 hash of the NFTs existing creators array (without the verified flag for the creator changed). // The creators array is retrieved from off-chain data store. creator_hash: [u8; 32], @@ -38,8 +35,6 @@ pub struct SolCnftFulfillBuyArgs { index: u32, // === Contract args === // - // Price of the NFT in the payment_mint. - buyer_price: u64, pub min_payment_amount: u64, pub maker_fee_bp: i16, // will be checked by cosigner pub taker_fee_bp: i16, // will be checked by cosigner diff --git a/programs/mmm/src/util.rs b/programs/mmm/src/util.rs index 8eeac3c..cad64b0 100644 --- a/programs/mmm/src/util.rs +++ b/programs/mmm/src/util.rs @@ -158,12 +158,7 @@ pub fn check_allowlists_for_mint( } pub fn check_allowlists_for_cnft(allowlists: &[Allowlist], collection: Collection) -> Result<()> { - // We need to check the following validation rules - // 1. make sure the metadata is correctly derived from the metadata pda with the mint - // 2. make sure mint+metadata(e.g. first verified creator address) can match one of the allowlist - // 3. note that the allowlist is unioned together, not intersection - // 4. skip if the allowlist.is_empty() - // 5. verify that nft either does not have master edition or is master edition + // Check mcc for cnft. for allowlist_val in allowlists.iter() { match allowlist_val.kind { ALLOWLIST_KIND_EMPTY => {} diff --git a/sdk/src/idl/mmm.ts b/sdk/src/idl/mmm.ts index 33fa9dc..0c3d5a7 100644 --- a/sdk/src/idl/mmm.ts +++ b/sdk/src/idl/mmm.ts @@ -2684,15 +2684,6 @@ export type Mmm = { ] } }, - { - "name": "metadataHash", - "type": { - "array": [ - "u8", - 32 - ] - } - }, { "name": "creatorHash", "type": { @@ -2710,10 +2701,6 @@ export type Mmm = { "name": "index", "type": "u32" }, - { - "name": "buyerPrice", - "type": "u64" - }, { "name": "minPaymentAmount", "type": "u64" @@ -5969,15 +5956,6 @@ export const IDL: Mmm = { ] } }, - { - "name": "metadataHash", - "type": { - "array": [ - "u8", - 32 - ] - } - }, { "name": "creatorHash", "type": { @@ -5995,10 +5973,6 @@ export const IDL: Mmm = { "name": "index", "type": "u32" }, - { - "name": "buyerPrice", - "type": "u64" - }, { "name": "minPaymentAmount", "type": "u64" diff --git a/tests/mmm-cnft.spec.ts b/tests/mmm-cnft.spec.ts index 46dfc62..86bf03b 100644 --- a/tests/mmm-cnft.spec.ts +++ b/tests/mmm-cnft.spec.ts @@ -225,11 +225,9 @@ describe('cnft tests', () => { const fulfillBuyTxnSig = await program.methods .cnftFulfillBuy({ root: getByteArray(nft.tree.root), - metadataHash: getByteArray(nft.tree.dataHash), creatorHash: getByteArray(nft.tree.creatorHash), nonce: new BN(nft.tree.nonce), index: nft.nft.nftIndex, - buyerPrice: new BN(spotPrice * LAMPORTS_PER_SOL), minPaymentAmount: new BN(expectedBuyPrices.sellerReceives), makerFeeBp: 0, takerFeeBp: 100, @@ -469,11 +467,9 @@ describe('cnft tests', () => { const fulfillBuyTxnSig = await program.methods .cnftFulfillBuy({ root: getByteArray(nft.tree.root), - metadataHash: getByteArray(nft.tree.dataHash), creatorHash: getByteArray(nft.tree.creatorHash), nonce: new BN(nft.tree.nonce), index: nft.nft.nftIndex, - buyerPrice: new BN(spotPrice * LAMPORTS_PER_SOL), minPaymentAmount: new BN(expectedBuyPrices.sellerReceives), makerFeeBp: 0, takerFeeBp: 100, @@ -687,11 +683,9 @@ describe('cnft tests', () => { const fulfillBuyTxnSig = await program.methods .cnftFulfillBuy({ root: getByteArray(nft.tree.root), - metadataHash: getByteArray(nft.tree.dataHash), creatorHash: getByteArray(nft.tree.creatorHash), nonce: new BN(nft.tree.nonce), index: nft.nft.nftIndex, - buyerPrice: new BN(spotPrice * LAMPORTS_PER_SOL), minPaymentAmount: new BN(expectedBuyPrices.sellerReceives), makerFeeBp: 0, takerFeeBp: 100,