diff --git a/programs/mmm/src/instructions/mpl_core_asset/mod.rs b/programs/mmm/src/instructions/mpl_core_asset/mod.rs index ef5660e..31d71b4 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/mod.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/mod.rs @@ -1,13 +1,13 @@ #![allow(missing_docs)] pub mod mpl_core_deposit_sell; -pub mod mpl_core_fulfill_buy; -pub mod mpl_core_fulfill_sell; pub mod mpl_core_withdraw_sell; pub mod mpl_core_wrap; +pub mod sol_mpl_core_fulfill_buy; +pub mod sol_mpl_core_fulfill_sell; pub use mpl_core_deposit_sell::*; -pub use mpl_core_fulfill_buy::*; -pub use mpl_core_fulfill_sell::*; pub use mpl_core_withdraw_sell::*; pub use mpl_core_wrap::*; +pub use sol_mpl_core_fulfill_buy::*; +pub use sol_mpl_core_fulfill_sell::*; diff --git a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs b/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs index d13e5f0..1d2b748 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/mpl_core_withdraw_sell.rs @@ -114,7 +114,7 @@ pub fn handler(ctx: Context, args: MplCoreWithdrawSellArgs) try_close_sell_state(sell_state, owner.to_account_info())?; pool.buyside_payment_amount = buyside_sol_escrow_account.lamports(); - log_pool("mpl_core_post_withdraw_sell", pool)?; + log_pool("post_mpl_core_withdraw_sell", pool)?; try_close_pool(pool, owner.to_account_info())?; Ok(()) diff --git a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_fulfill_buy.rs b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs similarity index 98% rename from programs/mmm/src/instructions/mpl_core_asset/mpl_core_fulfill_buy.rs rename to programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs index 42f55b4..9f63e07 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_fulfill_buy.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_buy.rs @@ -23,7 +23,7 @@ use crate::{ }; #[derive(AnchorSerialize, AnchorDeserialize)] -pub struct MplCoreFulfillBuyArgs { +pub struct SolMplCoreFulfillBuyArgs { pub min_payment_amount: u64, pub allowlist_aux: Option, pub maker_fee_bp: i16, @@ -32,8 +32,8 @@ pub struct MplCoreFulfillBuyArgs { } #[derive(Accounts)] -#[instruction(args:MplCoreFulfillBuyArgs)] -pub struct MplCoreFulfillBuy<'info> { +#[instruction(args:SolMplCoreFulfillBuyArgs)] +pub struct SolMplCoreFulfillBuy<'info> { #[account(mut)] pub payer: Signer<'info>, /// CHECK: we will check the owner field that matches the pool owner @@ -90,8 +90,8 @@ pub struct MplCoreFulfillBuy<'info> { } pub fn handler<'info>( - ctx: Context<'_, '_, '_, 'info, MplCoreFulfillBuy<'info>>, - args: MplCoreFulfillBuyArgs, + ctx: Context<'_, '_, '_, 'info, SolMplCoreFulfillBuy<'info>>, + args: SolMplCoreFulfillBuyArgs, ) -> Result<()> { let system_program = &ctx.accounts.system_program; let pool = &mut ctx.accounts.pool; diff --git a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_fulfill_sell.rs b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs similarity index 96% rename from programs/mmm/src/instructions/mpl_core_asset/mpl_core_fulfill_sell.rs rename to programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs index c633c3f..6e86613 100644 --- a/programs/mmm/src/instructions/mpl_core_asset/mpl_core_fulfill_sell.rs +++ b/programs/mmm/src/instructions/mpl_core_asset/sol_mpl_core_fulfill_sell.rs @@ -22,7 +22,7 @@ use crate::{ }; #[derive(AnchorSerialize, AnchorDeserialize)] -pub struct MplCoreFulfillSellArgs { +pub struct SolMplCoreFulfillSellArgs { pub max_payment_amount: u64, pub buyside_creator_royalty_bp: u16, pub allowlist_aux: Option, @@ -32,8 +32,8 @@ pub struct MplCoreFulfillSellArgs { } #[derive(Accounts)] -#[instruction(args:MplCoreFulfillSellArgs)] -pub struct MplCoreFulfillSell<'info> { +#[instruction(args:SolMplCoreFulfillSellArgs)] +pub struct SolMplCoreFulfillSell<'info> { #[account(mut)] pub payer: Signer<'info>, /// CHECK: we will check the owner field that matches the pool owner @@ -85,11 +85,11 @@ pub struct MplCoreFulfillSell<'info> { } pub fn handler<'info>( - ctx: Context<'_, '_, '_, 'info, MplCoreFulfillSell<'info>>, - args: MplCoreFulfillSellArgs, + ctx: Context<'_, '_, '_, 'info, SolMplCoreFulfillSell<'info>>, + args: SolMplCoreFulfillSellArgs, ) -> Result<()> { let system_program = &ctx.accounts.system_program; - let owner = &ctx.accounts.owner; + let owner: &UncheckedAccount<'info> = &ctx.accounts.owner; let referral = &ctx.accounts.referral; let pool = &mut ctx.accounts.pool; let asset = &ctx.accounts.asset; diff --git a/programs/mmm/src/lib.rs b/programs/mmm/src/lib.rs index 88ce411..50e2c76 100644 --- a/programs/mmm/src/lib.rs +++ b/programs/mmm/src/lib.rs @@ -167,17 +167,17 @@ pub mod mmm { instructions::mpl_core_withdraw_sell::handler(ctx, args) } - pub fn mpl_core_fulfill_sell<'info>( - ctx: Context<'_, '_, '_, 'info, MplCoreFulfillSell<'info>>, - args: MplCoreFulfillSellArgs, + pub fn sol_mpl_core_fulfill_sell<'info>( + ctx: Context<'_, '_, '_, 'info, SolMplCoreFulfillSell<'info>>, + args: SolMplCoreFulfillSellArgs, ) -> Result<()> { - instructions::mpl_core_fulfill_sell::handler(ctx, args) + instructions::sol_mpl_core_fulfill_sell::handler(ctx, args) } - pub fn mpl_core_fulfill_buy<'info>( - ctx: Context<'_, '_, '_, 'info, MplCoreFulfillBuy<'info>>, - args: MplCoreFulfillBuyArgs, + pub fn sol_mpl_core_fulfill_buy<'info>( + ctx: Context<'_, '_, '_, 'info, SolMplCoreFulfillBuy<'info>>, + args: SolMplCoreFulfillBuyArgs, ) -> Result<()> { - instructions::mpl_core_fulfill_buy::handler(ctx, args) + instructions::sol_mpl_core_fulfill_buy::handler(ctx, args) } } diff --git a/sdk/src/idl/mmm.ts b/sdk/src/idl/mmm.ts index 90908b5..ae6d289 100644 --- a/sdk/src/idl/mmm.ts +++ b/sdk/src/idl/mmm.ts @@ -2021,7 +2021,7 @@ export type Mmm = { ] }, { - "name": "mplCoreFulfillSell", + "name": "solMplCoreFulfillSell", "accounts": [ { "name": "payer", @@ -2083,13 +2083,13 @@ export type Mmm = { { "name": "args", "type": { - "defined": "MplCoreFulfillSellArgs" + "defined": "SolMplCoreFulfillSellArgs" } } ] }, { - "name": "mplCoreFulfillBuy", + "name": "solMplCoreFulfillBuy", "accounts": [ { "name": "payer", @@ -2151,7 +2151,7 @@ export type Mmm = { { "name": "args", "type": { - "defined": "MplCoreFulfillBuyArgs" + "defined": "SolMplCoreFulfillBuyArgs" } } ] @@ -2504,7 +2504,21 @@ export type Mmm = { } }, { - "name": "MplCoreFulfillBuyArgs", + "name": "MplCoreWithdrawSellArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "compressionProof", + "type": { + "option": "bytes" + } + } + ] + } + }, + { + "name": "SolMplCoreFulfillBuyArgs", "type": { "kind": "struct", "fields": [ @@ -2536,7 +2550,7 @@ export type Mmm = { } }, { - "name": "MplCoreFulfillSellArgs", + "name": "SolMplCoreFulfillSellArgs", "type": { "kind": "struct", "fields": [ @@ -2571,20 +2585,6 @@ export type Mmm = { ] } }, - { - "name": "MplCoreWithdrawSellArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "compressionProof", - "type": { - "option": "bytes" - } - } - ] - } - }, { "name": "SolOcpFulfillSellArgs", "type": { @@ -4958,7 +4958,7 @@ export const IDL: Mmm = { ] }, { - "name": "mplCoreFulfillSell", + "name": "solMplCoreFulfillSell", "accounts": [ { "name": "payer", @@ -5020,13 +5020,13 @@ export const IDL: Mmm = { { "name": "args", "type": { - "defined": "MplCoreFulfillSellArgs" + "defined": "SolMplCoreFulfillSellArgs" } } ] }, { - "name": "mplCoreFulfillBuy", + "name": "solMplCoreFulfillBuy", "accounts": [ { "name": "payer", @@ -5088,7 +5088,7 @@ export const IDL: Mmm = { { "name": "args", "type": { - "defined": "MplCoreFulfillBuyArgs" + "defined": "SolMplCoreFulfillBuyArgs" } } ] @@ -5441,7 +5441,21 @@ export const IDL: Mmm = { } }, { - "name": "MplCoreFulfillBuyArgs", + "name": "MplCoreWithdrawSellArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "compressionProof", + "type": { + "option": "bytes" + } + } + ] + } + }, + { + "name": "SolMplCoreFulfillBuyArgs", "type": { "kind": "struct", "fields": [ @@ -5473,7 +5487,7 @@ export const IDL: Mmm = { } }, { - "name": "MplCoreFulfillSellArgs", + "name": "SolMplCoreFulfillSellArgs", "type": { "kind": "struct", "fields": [ @@ -5508,20 +5522,6 @@ export const IDL: Mmm = { ] } }, - { - "name": "MplCoreWithdrawSellArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "compressionProof", - "type": { - "option": "bytes" - } - } - ] - } - }, { "name": "SolOcpFulfillSellArgs", "type": { diff --git a/sdk/src/mmmClient.ts b/sdk/src/mmmClient.ts index d7ff8fc..83020a0 100644 --- a/sdk/src/mmmClient.ts +++ b/sdk/src/mmmClient.ts @@ -305,7 +305,7 @@ export class MMMClient { | ReturnType | ReturnType | ReturnType - | ReturnType; + | ReturnType; const mintOrCoreAsset = await this.conn.getAccountInfo(assetMint); let { key: buysideSolEscrowAccount } = getMMMBuysideSolEscrowPDA( @@ -327,9 +327,9 @@ export class MMMClient { allowlistAux: args.allowlistAux, takerFeeBp: args.takerFeeBp, makerFeeBp: args.makerFeeBp, - } as anchor.IdlTypes['MplCoreFulfillBuyArgs']; + } as anchor.IdlTypes['SolMplCoreFulfillBuyArgs']; builder = this.program.methods - .mplCoreFulfillBuy(mplCoreArgs) + .solMplCoreFulfillBuy(mplCoreArgs) .accountsStrict({ payer: payer, owner: this.poolData.owner, @@ -567,7 +567,7 @@ export class MMMClient { | ReturnType | ReturnType | ReturnType - | ReturnType; + | ReturnType; const mintOrCoreAsset = await this.conn.getAccountInfo(assetMint); const { key: sellState } = getMMMSellStatePDA( @@ -586,9 +586,9 @@ export class MMMClient { buysideCreatorRoyaltyBp: args.buysideCreatorRoyaltyBp, makerFeeBp: args.makerFeeBp, takerFeeBp: args.takerFeeBp, - } as anchor.IdlTypes['MplCoreFulfillSellArgs']; + } as anchor.IdlTypes['SolMplCoreFulfillSellArgs']; builder = this.program.methods - .mplCoreFulfillSell(mplCoreArgs) + .solMplCoreFulfillSell(mplCoreArgs) .accountsStrict({ payer, owner: this.poolData.owner, diff --git a/tests/mmm-mpl-core.spec.ts b/tests/mmm-mpl-core.spec.ts index 268e5b6..a2a7e60 100644 --- a/tests/mmm-mpl-core.spec.ts +++ b/tests/mmm-mpl-core.spec.ts @@ -553,7 +553,7 @@ describe('mmm-mpl-core', () => { let expectedTakerFees = 1 * LAMPORTS_PER_SOL * 0.01; const tx = await program.methods - .mplCoreFulfillSell({ + .solMplCoreFulfillSell({ maxPaymentAmount: new anchor.BN( 1.02 * LAMPORTS_PER_SOL + expectedTakerFees, ), @@ -723,7 +723,7 @@ describe('mmm-mpl-core', () => { let expectedTakerFees = 1 * LAMPORTS_PER_SOL * 0.01; const tx = await program.methods - .mplCoreFulfillSell({ + .solMplCoreFulfillSell({ maxPaymentAmount: new anchor.BN( 1.02 * LAMPORTS_PER_SOL + expectedTakerFees, ), @@ -895,7 +895,7 @@ describe('mmm-mpl-core', () => { let expectedTakerFees = 1 * LAMPORTS_PER_SOL * 0.01; const tx = await program.methods - .mplCoreFulfillSell({ + .solMplCoreFulfillSell({ maxPaymentAmount: new anchor.BN( 1.05 * LAMPORTS_PER_SOL + expectedTakerFees, ), @@ -1039,7 +1039,7 @@ describe('mmm-mpl-core', () => { let expectedTakerFees = 1 * LAMPORTS_PER_SOL * 0.01; const tx = await program.methods - .mplCoreFulfillSell({ + .solMplCoreFulfillSell({ maxPaymentAmount: new anchor.BN( 1.01 * LAMPORTS_PER_SOL + expectedTakerFees, ), @@ -1197,7 +1197,7 @@ describe('mmm-mpl-core', () => { makerFeeBp: 100, }); const tx = await program.methods - .mplCoreFulfillBuy({ + .solMplCoreFulfillBuy({ minPaymentAmount: new anchor.BN(expectedBuyPrices.sellerReceives), allowlistAux: '', takerFeeBp: 100, @@ -1384,7 +1384,7 @@ describe('mmm-mpl-core', () => { makerFeeBp: 0, }); const tx = await program.methods - .mplCoreFulfillBuy({ + .solMplCoreFulfillBuy({ minPaymentAmount: new anchor.BN(expectedBuyPrices.sellerReceives), allowlistAux: '', takerFeeBp: 100, @@ -1558,7 +1558,7 @@ describe('mmm-mpl-core', () => { await airdrop(connection, buyer.publicKey, 10); try { await program.methods - .mplCoreFulfillBuy({ + .solMplCoreFulfillBuy({ minPaymentAmount: new anchor.BN(0), allowlistAux: '', takerFeeBp: 100,