Skip to content

Commit

Permalink
Added support for SPL Token program 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
kstepanovdev committed Feb 15, 2024
1 parent a8ee689 commit d91b91d
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 19 deletions.
218 changes: 206 additions & 12 deletions programs/inscription/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion programs/inscription/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ num-derive = "^0.3"
num-traits = "^0.2"
solana-program = "~1.16"
thiserror = "^1.0"
mpl-utils = "0.3.1"
mpl-utils = "0.3.3"
serde_json = { version = "1.0.108", features = ["std"] }
mpl-token-metadata = "3.2.3"
spl-token = { version = "4.0.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "0.8", features = ["no-entrypoint"] }
7 changes: 4 additions & 3 deletions programs/inscription/src/processor/initialize_from_mint.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use borsh::{BorshDeserialize, BorshSerialize};
use mpl_token_metadata::accounts::Metadata;
use mpl_utils::{
assert_derivation, assert_owned_by, assert_signer, create_or_allocate_account_raw,
assert_derivation, assert_owned_by, assert_owner_in, assert_signer,
create_or_allocate_account_raw, token::SPL_TOKEN_PROGRAM_IDS,
};
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_memory::sol_memcpy,
Expand Down Expand Up @@ -38,9 +39,9 @@ pub(crate) fn process_initialize_from_mint<'a>(accounts: &'a [AccountInfo<'a>])
MplInscriptionError::IncorrectOwner,
)?;

assert_owned_by(
assert_owner_in(
ctx.accounts.mint_account,
&spl_token::ID,
&SPL_TOKEN_PROGRAM_IDS,
MplInscriptionError::IncorrectOwner,
)?;

Expand Down
7 changes: 4 additions & 3 deletions programs/inscription/src/processor/set_mint.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use borsh::{BorshDeserialize, BorshSerialize};

use mpl_utils::{
assert_derivation, assert_owned_by, assert_signer, resize_or_reallocate_account_raw,
assert_derivation, assert_owner_in, assert_signer, resize_or_reallocate_account_raw,
token::SPL_TOKEN_PROGRAM_IDS,
};
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_memory::sol_memcpy,
Expand Down Expand Up @@ -33,9 +34,9 @@ pub(crate) fn process_set_mint<'a>(accounts: &'a [AccountInfo<'a>]) -> ProgramRe
return Err(MplInscriptionError::NotInitialized.into());
}

assert_owned_by(
assert_owner_in(
ctx.accounts.mint_account,
&spl_token::ID,
&SPL_TOKEN_PROGRAM_IDS,
MplInscriptionError::IncorrectOwner,
)?;

Expand Down

0 comments on commit d91b91d

Please sign in to comment.