Skip to content

Commit

Permalink
Minor cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Apr 9, 2024
1 parent ab5eea5 commit b12a69a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,17 @@ pub fn mint_v1(program_id: &Pubkey, ctx: Context<Mint>, args: MintArgs) -> Progr
.edition_nonce
.ok_or(MetadataError::NotAMasterEdition)?],
];
// let master_edition_key =
// Pubkey::create_program_address(master_edition_seeds, program_id)?;

let master_edition_info = ctx
.accounts
.master_edition_info
.ok_or(MetadataError::MissingMasterEditionAccount)?;

// if !cmp_pubkeys(master_edition_info.key, &master_edition_key) {
// return Err(MetadataError::InvalidMasterEdition.into());
// }
assert_derivation_with_bump(
&crate::ID,
master_edition_info,
master_edition_seeds,
MetadataError::MissingMasterEditionAccount,
MetadataError::InvalidMasterEdition,
)?;

// thaw the token account for programmable assets; the account
Expand Down
28 changes: 16 additions & 12 deletions programs/token-metadata/program/src/utils/programmable_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub fn freeze<'a>(
}
None => assert_derivation(&crate::ID, &edition, &edition_info_path),
}?;
let mut edition_info_seeds = edition_info_path.clone();
let mut edition_info_seeds = edition_info_path;
let binding = [bump];
edition_info_seeds.push(&binding);

Expand Down Expand Up @@ -143,9 +143,8 @@ pub fn thaw<'a>(
}
None => assert_derivation(&crate::ID, &edition_info, &edition_info_path),
}?;
let mut edition_info_seeds = edition_info_path.clone();
let binding = [bump];
edition_info_seeds.push(&binding);
let edition_info_seeds = [edition_info_path, vec![&binding]].concat();

invoke_signed(
&thaw_account(
Expand Down Expand Up @@ -394,18 +393,23 @@ pub(crate) fn clear_close_authority(params: ClearCloseAuthorityParams) -> Progra
return Err(MetadataError::InvalidCloseAuthority.into());
}

let path = vec![
"metadata".as_bytes(),
crate::ID.as_ref(),
mint_info.key.as_ref(),
"edition".as_bytes(),
];
let bump = edition_bump.unwrap_or(Pubkey::find_program_address(&path, &crate::ID).1);
let bump = edition_bump.unwrap_or(
Pubkey::find_program_address(
&[
PREFIX.as_bytes(),
crate::ID.as_ref(),
mint_info.key.as_ref(),
EDITION.as_bytes(),
],
&crate::ID,
)
.1,
);
let seeds = &[
"metadata".as_bytes(),
PREFIX.as_bytes(),
crate::ID.as_ref(),
mint_info.key.as_ref(),
"edition".as_bytes(),
EDITION.as_bytes(),
&[bump],
];

Expand Down

0 comments on commit b12a69a

Please sign in to comment.