From c9c66af218c579fc0fb638bb3ca3b04391a4c2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wei=C3=9Fer=20Hase?= Date: Fri, 4 Oct 2024 13:10:48 -0300 Subject: [PATCH] feat: adding mint address validation at create --- program/src/processor.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/program/src/processor.rs b/program/src/processor.rs index b5ac208..ac6056b 100644 --- a/program/src/processor.rs +++ b/program/src/processor.rs @@ -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, @@ -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)?;