PROJECT FILES
main.rs
// Sagechain AI - Token Program
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint,
entrypoint::ProgramResult,
msg,
program_error::ProgramError,
pubkey::Pubkey,
program_pack::{Pack, IsInitialized},
sysvar::{rent::Rent, Sysvar},
};
// Program entrypoint
entrypoint!(process_instruction);
pub fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> ProgramResult {
let instruction = TokenInstruction::unpack(instruction_data)?;
match instruction {
TokenInstruction::InitializeMint { decimals, mint_authority } => {
msg!("Instruction: Initialize Mint");
process_initialize_mint(accounts, decimals, mint_authority, program_id)
},
TokenInstruction::Transfer { amount } => {
msg!("Instruction: Transfer");
process_transfer(accounts, amount, program_id)
}
}
}
Click "Compile & Run" to start the compilation process.