Skip to content

Commit 93adbec

Browse files
febojoncinque
authored andcommitted
Use interface program id
1 parent befd422 commit 93adbec

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

interface/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ pub mod native_mint;
44
pub mod state;
55

66
pub mod program {
7-
pinocchio_pubkey::declare_id!("PToken1111111111111111111111111111111111111");
7+
pinocchio_pubkey::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
88
}

p-token/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@
44

55
mod entrypoint;
66
mod processor;
7-
8-
pinocchio_pubkey::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");

p-token/src/processor/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use pinocchio::{
1010
};
1111
use token_interface::{
1212
error::TokenError,
13+
program::ID as TOKEN_PROGRAM_ID,
1314
state::{
1415
load,
1516
multisig::{Multisig, MAX_SIGNERS},
@@ -84,7 +85,7 @@ const MAX_FORMATTED_DIGITS: usize = u8::MAX as usize + 2;
8485
/// Checks that the account is owned by the expected program.
8586
#[inline(always)]
8687
fn check_account_owner(account_info: &AccountInfo) -> ProgramResult {
87-
if &crate::ID != account_info.owner() {
88+
if &TOKEN_PROGRAM_ID != account_info.owner() {
8889
Err(ProgramError::IncorrectProgramId)
8990
} else {
9091
Ok(())
@@ -102,7 +103,9 @@ fn validate_owner(
102103
return Err(TokenError::OwnerMismatch.into());
103104
}
104105

105-
if owner_account_info.data_len() == Multisig::LEN && &crate::ID == owner_account_info.owner() {
106+
if owner_account_info.data_len() == Multisig::LEN
107+
&& owner_account_info.owner() == &TOKEN_PROGRAM_ID
108+
{
106109
let multisig = unsafe { load::<Multisig>(owner_account_info.borrow_data_unchecked())? };
107110

108111
let mut num_signers = 0;

0 commit comments

Comments
 (0)