diff --git a/Cargo.lock b/Cargo.lock index 3f58be13..73ef4d92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3266,6 +3266,7 @@ dependencies = [ "num-traits", "pinocchio", "pinocchio-log", + "pinocchio-pubkey", "pinocchio-token-interface", "solana-account", "solana-instruction", diff --git a/pinocchio/program/Cargo.toml b/pinocchio/program/Cargo.toml index 974bedd6..c9eea7e5 100644 --- a/pinocchio/program/Cargo.toml +++ b/pinocchio/program/Cargo.toml @@ -17,6 +17,7 @@ logging = [] [dependencies] pinocchio = { workspace = true } pinocchio-log = { version = "0.5.1", default-features = false } +pinocchio-pubkey = "0.3" pinocchio-token-interface = { version = "^0", path = "../interface" } [dev-dependencies] diff --git a/pinocchio/program/src/processor/mod.rs b/pinocchio/program/src/processor/mod.rs index 07cb8985..ff0ab7bb 100644 --- a/pinocchio/program/src/processor/mod.rs +++ b/pinocchio/program/src/processor/mod.rs @@ -73,6 +73,11 @@ pub use { /// Number of bytes in a `u64`. const U64_BYTES: usize = core::mem::size_of::(); +/// Token-2022 program id, to allow for its multisigs to be used in p-token +mod spl_token_2022 { + pinocchio_pubkey::declare_id!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"); +} + /// Maximum number of digits in a formatted `u64`. /// /// The maximum number of digits is equal to the maximum number @@ -111,7 +116,8 @@ unsafe fn validate_owner( if unlikely( owner_account_info.data_len() == Multisig::LEN - && owner_account_info.is_owned_by(&TOKEN_PROGRAM_ID), + && (owner_account_info.is_owned_by(&TOKEN_PROGRAM_ID) + || owner_account_info.is_owned_by(&spl_token_2022::ID)), ) { // SAFETY: the caller guarantees that there are no mutable borrows of // `owner_account_info` account data and the `load` validates that the