-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MplCore] Deposit sell #93
Conversation
pub pool: Box<Account<'info, Pool>>, | ||
#[account( | ||
mut, | ||
constraint = asset.to_account_info().owner == asset_program.key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check the ownership here? maybe cpi of transfer does this, good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will reply on cpi check for now
programs/mmm/src/util.rs
Outdated
@@ -783,6 +785,68 @@ pub fn check_allowlists_for_mint_ext( | |||
Err(MMMErrorCode::InvalidAllowLists.into()) | |||
} | |||
|
|||
pub fn check_allowlists_for_mpl_core<'info>( | |||
allowlists: &[Allowlist], | |||
asset: &Box<Account<'info, IndexableAsset>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be able to just
asset: &Box<Account<'info, IndexableAsset>>, | |
asset: &IndexableAsset, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting, "Deref coercion", good rust learning
programs/mmm/src/instructions/mpl_core_asset/mpl_core_deposit_sell.rs
Outdated
Show resolved
Hide resolved
) -> Result<()> { | ||
if allowlists | ||
.iter() | ||
.any(|&val| val.kind == ALLOWLIST_KIND_METADATA) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explore if we can make Core's onchain traits verifiable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be address in the future when we support onchain attribute offer for mpl core
export function isMplCoreAsset( | ||
account: anchor.web3.AccountInfo<Buffer>, | ||
): boolean { | ||
return account?.owner.equals(new PublicKey(MPL_CORE_PROGRAM_ID)) ?? false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MPL_CORE_PROGRAM_ID is already a PublicKey, right? so we don't need a new
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a separate PublicKey type defined in mpl core package, need to convert to web3 type here
return Err(MMMErrorCode::InvalidAccountState.into()); | ||
} | ||
|
||
let _ = check_allowlists_for_mpl_core(&pool.allowlists, asset, args.allowlist_aux)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: don't need let _ =
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiler seems will show some warning if I remove them
Added new
mpl_core_deposit_sell.rs
instruction and sdk + testsupdate_authority
to be used by mpl core collections.