Skip to content

Commit

Permalink
Require TM collection data delegate for update metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Sep 5, 2024
1 parent d560dd1 commit 64f1fb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion programs/bubblegum/program/src/asserts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub fn assert_has_collection_authority(
mint: &Pubkey,
collection_authority: &Pubkey,
delegate_record: Option<&AccountInfo>,
metadata_delegate_role: MetadataDelegateRole,
) -> Result<()> {
// Mint is the correct one for the metadata account.
if collection_data.mint != *mint {
Expand All @@ -112,7 +113,7 @@ pub fn assert_has_collection_authority(
let (ca_pda, ca_bump) = CollectionAuthorityRecord::find_pda(mint, collection_authority);
let (md_pda, md_bump) = MetadataDelegateRecord::find_pda(
mint,
MetadataDelegateRole::Collection,
metadata_delegate_role,
&collection_data.update_authority,
collection_authority,
);
Expand Down
2 changes: 2 additions & 0 deletions programs/bubblegum/program/src/processor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anchor_lang::prelude::*;
use mpl_token_metadata::types::MetadataDelegateRole;
use solana_program::{account_info::AccountInfo, pubkey::Pubkey};
use spl_account_compression::wrap_application_data_v1;

Expand Down Expand Up @@ -197,6 +198,7 @@ fn process_collection_verification_mpl_only<'info>(
collection_mint.key,
collection_authority.key,
collection_authority_record,
MetadataDelegateRole::Collection,
)?;

// Update collection in metadata args. Note since this is a mutable reference,
Expand Down
2 changes: 2 additions & 0 deletions programs/bubblegum/program/src/processor/update_metadata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anchor_lang::prelude::*;
use mpl_token_metadata::types::MetadataDelegateRole;
use spl_account_compression::{program::SplAccountCompression, wrap_application_data_v1, Noop};

use crate::{
Expand Down Expand Up @@ -85,6 +86,7 @@ fn assert_authority_matches_collection<'info>(
collection_mint.key,
collection_authority.key,
collection_authority_record.as_ref(),
MetadataDelegateRole::Data,
)?;

Ok(())
Expand Down

0 comments on commit 64f1fb5

Please sign in to comment.