Skip to content

Commit

Permalink
Removing token standard check and locking inscribing to UA.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Dec 11, 2023
1 parent b180cfb commit 32ce1e9
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions programs/mpl-inscription/src/processor/initialize_from_mint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use borsh::{BorshDeserialize, BorshSerialize};
use mpl_token_metadata::{accounts::Metadata, types::TokenStandard};
use mpl_token_metadata::accounts::Metadata;
use mpl_utils::{
assert_derivation, assert_initialized, assert_owned_by, assert_signer,
create_or_allocate_account_raw,
Expand Down Expand Up @@ -60,19 +60,6 @@ pub(crate) fn process_initialize_from_mint<'a>(accounts: &'a [AccountInfo<'a>])
return Err(MplInscriptionError::MintMismatch.into());
}

let token_standard = token_metadata
.token_standard
.ok_or(MplInscriptionError::InvalidTokenStandard)?;
if !matches!(
token_standard,
TokenStandard::NonFungible
| TokenStandard::NonFungibleEdition
| TokenStandard::ProgrammableNonFungible
| TokenStandard::ProgrammableNonFungibleEdition
) {
return Err(MplInscriptionError::InvalidTokenStandard.into());
}

let token_account: spl_token::state::Account = assert_initialized(
ctx.accounts.token_account,
MplInscriptionError::BorshDeserializeError,
Expand All @@ -90,6 +77,10 @@ pub(crate) fn process_initialize_from_mint<'a>(accounts: &'a [AccountInfo<'a>])
return Err(MplInscriptionError::MintMismatch.into());
}

if token_metadata.update_authority != *ctx.accounts.payer.key {
return Err(MplInscriptionError::InvalidAuthority.into());
}

// Verify that the derived address is correct for the metadata account.
let inscription_bump = assert_derivation(
&crate::ID,
Expand Down Expand Up @@ -136,17 +127,12 @@ pub(crate) fn process_initialize_from_mint<'a>(accounts: &'a [AccountInfo<'a>])
],
)?;

let mut update_authorities = vec![token_metadata.update_authority];
if token_metadata.update_authority != *ctx.accounts.payer.key {
update_authorities.push(*ctx.accounts.payer.key);
}

// Initialize the inscription metadata.
let mut inscription_metadata = InscriptionMetadata {
key: Key::MintInscriptionMetadataAccount,
bump,
inscription_bump: Some(inscription_bump),
update_authorities,
update_authorities: vec![token_metadata.update_authority],
..InscriptionMetadata::default()
};

Expand Down

0 comments on commit 32ce1e9

Please sign in to comment.