Skip to content

Commit

Permalink
[mmm] Rename mpl core fulfillment func & args (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
solonk8 authored May 20, 2024
1 parent 22424a2 commit 960ac4e
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 77 deletions.
8 changes: 4 additions & 4 deletions programs/mmm/src/instructions/mpl_core_asset/mod.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub fn handler(ctx: Context<MplCoreWithdrawSell>, 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(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
};

#[derive(AnchorSerialize, AnchorDeserialize)]
pub struct MplCoreFulfillBuyArgs {
pub struct SolMplCoreFulfillBuyArgs {
pub min_payment_amount: u64,
pub allowlist_aux: Option<String>,
pub maker_fee_bp: i16,
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions programs/mmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
80 changes: 40 additions & 40 deletions sdk/src/idl/mmm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ export type Mmm = {
]
},
{
"name": "mplCoreFulfillSell",
"name": "solMplCoreFulfillSell",
"accounts": [
{
"name": "payer",
Expand Down Expand Up @@ -2083,13 +2083,13 @@ export type Mmm = {
{
"name": "args",
"type": {
"defined": "MplCoreFulfillSellArgs"
"defined": "SolMplCoreFulfillSellArgs"
}
}
]
},
{
"name": "mplCoreFulfillBuy",
"name": "solMplCoreFulfillBuy",
"accounts": [
{
"name": "payer",
Expand Down Expand Up @@ -2151,7 +2151,7 @@ export type Mmm = {
{
"name": "args",
"type": {
"defined": "MplCoreFulfillBuyArgs"
"defined": "SolMplCoreFulfillBuyArgs"
}
}
]
Expand Down Expand Up @@ -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": [
Expand Down Expand Up @@ -2536,7 +2550,7 @@ export type Mmm = {
}
},
{
"name": "MplCoreFulfillSellArgs",
"name": "SolMplCoreFulfillSellArgs",
"type": {
"kind": "struct",
"fields": [
Expand Down Expand Up @@ -2571,20 +2585,6 @@ export type Mmm = {
]
}
},
{
"name": "MplCoreWithdrawSellArgs",
"type": {
"kind": "struct",
"fields": [
{
"name": "compressionProof",
"type": {
"option": "bytes"
}
}
]
}
},
{
"name": "SolOcpFulfillSellArgs",
"type": {
Expand Down Expand Up @@ -4958,7 +4958,7 @@ export const IDL: Mmm = {
]
},
{
"name": "mplCoreFulfillSell",
"name": "solMplCoreFulfillSell",
"accounts": [
{
"name": "payer",
Expand Down Expand Up @@ -5020,13 +5020,13 @@ export const IDL: Mmm = {
{
"name": "args",
"type": {
"defined": "MplCoreFulfillSellArgs"
"defined": "SolMplCoreFulfillSellArgs"
}
}
]
},
{
"name": "mplCoreFulfillBuy",
"name": "solMplCoreFulfillBuy",
"accounts": [
{
"name": "payer",
Expand Down Expand Up @@ -5088,7 +5088,7 @@ export const IDL: Mmm = {
{
"name": "args",
"type": {
"defined": "MplCoreFulfillBuyArgs"
"defined": "SolMplCoreFulfillBuyArgs"
}
}
]
Expand Down Expand Up @@ -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": [
Expand Down Expand Up @@ -5473,7 +5487,7 @@ export const IDL: Mmm = {
}
},
{
"name": "MplCoreFulfillSellArgs",
"name": "SolMplCoreFulfillSellArgs",
"type": {
"kind": "struct",
"fields": [
Expand Down Expand Up @@ -5508,20 +5522,6 @@ export const IDL: Mmm = {
]
}
},
{
"name": "MplCoreWithdrawSellArgs",
"type": {
"kind": "struct",
"fields": [
{
"name": "compressionProof",
"type": {
"option": "bytes"
}
}
]
}
},
{
"name": "SolOcpFulfillSellArgs",
"type": {
Expand Down
12 changes: 6 additions & 6 deletions sdk/src/mmmClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export class MMMClient {
| ReturnType<MmmMethodsNamespace['solFulfillBuy']>
| ReturnType<MmmMethodsNamespace['solMip1FulfillBuy']>
| ReturnType<MmmMethodsNamespace['solExtFulfillBuy']>
| ReturnType<MmmMethodsNamespace['mplCoreFulfillBuy']>;
| ReturnType<MmmMethodsNamespace['solMplCoreFulfillBuy']>;

const mintOrCoreAsset = await this.conn.getAccountInfo(assetMint);
let { key: buysideSolEscrowAccount } = getMMMBuysideSolEscrowPDA(
Expand All @@ -327,9 +327,9 @@ export class MMMClient {
allowlistAux: args.allowlistAux,
takerFeeBp: args.takerFeeBp,
makerFeeBp: args.makerFeeBp,
} as anchor.IdlTypes<Mmm>['MplCoreFulfillBuyArgs'];
} as anchor.IdlTypes<Mmm>['SolMplCoreFulfillBuyArgs'];
builder = this.program.methods
.mplCoreFulfillBuy(mplCoreArgs)
.solMplCoreFulfillBuy(mplCoreArgs)
.accountsStrict({
payer: payer,
owner: this.poolData.owner,
Expand Down Expand Up @@ -567,7 +567,7 @@ export class MMMClient {
| ReturnType<MmmMethodsNamespace['solFulfillSell']>
| ReturnType<MmmMethodsNamespace['solMip1FulfillSell']>
| ReturnType<MmmMethodsNamespace['solExtFulfillSell']>
| ReturnType<MmmMethodsNamespace['mplCoreFulfillSell']>;
| ReturnType<MmmMethodsNamespace['solMplCoreFulfillSell']>;

const mintOrCoreAsset = await this.conn.getAccountInfo(assetMint);
const { key: sellState } = getMMMSellStatePDA(
Expand All @@ -586,9 +586,9 @@ export class MMMClient {
buysideCreatorRoyaltyBp: args.buysideCreatorRoyaltyBp,
makerFeeBp: args.makerFeeBp,
takerFeeBp: args.takerFeeBp,
} as anchor.IdlTypes<Mmm>['MplCoreFulfillSellArgs'];
} as anchor.IdlTypes<Mmm>['SolMplCoreFulfillSellArgs'];
builder = this.program.methods
.mplCoreFulfillSell(mplCoreArgs)
.solMplCoreFulfillSell(mplCoreArgs)
.accountsStrict({
payer,
owner: this.poolData.owner,
Expand Down
14 changes: 7 additions & 7 deletions tests/mmm-mpl-core.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down Expand Up @@ -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,
),
Expand Down Expand Up @@ -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,
),
Expand Down Expand Up @@ -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,
),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 960ac4e

Please sign in to comment.