Skip to content

Commit

Permalink
feat: adding mint address validation at create
Browse files Browse the repository at this point in the history
  • Loading branch information
wei3erHase committed Oct 4, 2024
1 parent 175303f commit c9c66af
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use solana_program::{
program_error::PrintProgramError,
program_error::ProgramError,
program_pack::Pack,
pubkey,
pubkey::Pubkey,
rent::Rent,
system_instruction::create_account,
Expand Down Expand Up @@ -75,6 +76,15 @@ impl Processor {
mint_address: &Pubkey,
schedule: Schedule,
) -> ProgramResult {
// Define the required mint address
const TOKEN_MINT_ADDRESS: Pubkey = pubkey!("AxfBPA1yi6my7VAjqB9fqr1AgYczuuJy8tePnNUDDPpW");

// Validate the mint address matches the expected token address
if *mint_address != TOKEN_MINT_ADDRESS {
msg!("Invalid mint address: Only 'TokenABCD' is supported.");
return Err(ProgramError::InvalidArgument);
}

let accounts_iter = &mut accounts.iter();

let spl_token_account = next_account_info(accounts_iter)?;
Expand Down

0 comments on commit c9c66af

Please sign in to comment.