Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
daoplays committed May 3, 2024
1 parent e99a8e8 commit 27d6083
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions programs/mpl-core/src/processor/update_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,7 @@ pub(crate) fn update_plugin_v2<'a>(
// Accounts.
let ctx = UpdatePluginV2Accounts::context(accounts)?;

// Guards.
assert_signer(ctx.accounts.payer)?;
let _authority = resolve_authority(ctx.accounts.payer, ctx.accounts.authority)?;

if ctx.accounts.system_program.key != &solana_program::system_program::ID {
return Err(MplCoreError::InvalidSystemProgram.into());
}

if let Some(log_wrapper) = ctx.accounts.log_wrapper {
if log_wrapper.key != &spl_noop::ID {
return Err(MplCoreError::InvalidLogWrapperProgram.into());
}
}
// account checks will be done in update_plugin

let plugin: Plugin = if ctx.accounts.buffer_account.is_some() {
Plugin::try_from_slice(&ctx.accounts.buffer_account.unwrap().data.borrow()[..])?
Expand Down Expand Up @@ -330,28 +318,14 @@ pub(crate) fn update_collection_plugin_v2<'a>(
// Accounts.
let ctx = UpdateCollectionPluginV2Accounts::context(accounts)?;

// Guards.
assert_signer(ctx.accounts.payer)?;
let _authority = resolve_authority(ctx.accounts.payer, ctx.accounts.authority)?;

if ctx.accounts.system_program.key != &solana_program::system_program::ID {
return Err(MplCoreError::InvalidSystemProgram.into());
}

if let Some(log_wrapper) = ctx.accounts.log_wrapper {
if log_wrapper.key != &spl_noop::ID {
return Err(MplCoreError::InvalidLogWrapperProgram.into());
}
}
// account checks will be done in update_plugin

let plugin: Plugin = if ctx.accounts.buffer_account.is_some() {
Plugin::try_from_slice(&ctx.accounts.buffer_account.unwrap().data.borrow()[..])?
} else {
args.plugin.unwrap()
};

msg!("plugin: {:?}", plugin);

update_collection_plugin(accounts, UpdateCollectionPluginV1Args { plugin: plugin })?;

Ok(())
Expand Down

0 comments on commit 27d6083

Please sign in to comment.