Skip to content

Commit

Permalink
Preventing close when AIA's remain.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Jan 15, 2024
1 parent ca6f856 commit ad99e9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions programs/mpl-inscription/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ pub enum MplInscriptionError {
/// 16 - Authority Already Exists
#[error("The authority already exists.")]
AuthorityAlreadyExists,

/// 17 - Remaining Associated Inscription Accounts
#[error("Cannot close Inscription accounts until all Associated Inscriptions are closed.")]
RemainingAssociatedInscriptionAccounts,
}

impl PrintProgramError for MplInscriptionError {
Expand Down
4 changes: 4 additions & 0 deletions programs/mpl-inscription/src/processor/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ pub(crate) fn process_close<'a>(accounts: &'a [AccountInfo<'a>], args: CloseArgs
close_account_raw(ctx.accounts.payer, ctx.accounts.inscription_account)?;
}
None => {
if !inscription_metadata.associated_inscriptions.is_empty() {
return Err(MplInscriptionError::RemainingAssociatedInscriptionAccounts.into());
}

let bump = assert_derivation(
&crate::ID,
ctx.accounts.inscription_metadata_account,
Expand Down

0 comments on commit ad99e9e

Please sign in to comment.