pub mod create_v2 {
use borsh::{BorshDeserialize, BorshSerialize};
use solana_sdk::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
};
pub const DISCRIMINATOR: [u8; 8] = [214, 144, 76, 236, 95, 139, 49, 180];
#[derive(Debug, Clone, BorshSerialize, BorshDeserialize)]
pub struct Args {
pub name: String,
pub symbol: String,
pub uri: String,
pub is_mayhem_mode: bool,
}
#[derive(Debug, Clone, Copy)]
pub struct Accounts {
pub mint: Pubkey,
pub mint_authority: Pubkey,
pub bonding_curve: Pubkey,
pub associated_bonding_curve_token_account: Pubkey,
pub global: Pubkey,
pub user: Pubkey,
pub system_program: Pubkey,
pub token_program: Pubkey,
pub associated_token_program: Pubkey,
pub mayhem_program: Pubkey,
pub global_params: Pubkey,
pub sol_vault: Pubkey,
pub mayhem_state: Pubkey,
pub mayhem_token_vault: Pubkey,
}
pub fn build_ix(program_id: Pubkey, a: Accounts, args: Args) -> Instruction {
let mut data = Vec::with_capacity(8 + 128);
data.extend_from_slice(&DISCRIMINATOR);
data.extend_from_slice(&borsh::to_vec(&args).expect("borsh serialize"));
let accounts = vec![
AccountMeta::new(a.mint, true),
AccountMeta::new_readonly(a.mint_authority, false),
AccountMeta::new(a.bonding_curve, false),
AccountMeta::new(a.associated_bonding_curve_token_account, false),
AccountMeta::new(a.global, false),
AccountMeta::new(a.user, true),
AccountMeta::new_readonly(a.system_program, false),
AccountMeta::new_readonly(a.token_program, false),
AccountMeta::new_readonly(a.associated_token_program, false),
AccountMeta::new_readonly(a.mayhem_program, false),
AccountMeta::new_readonly(a.global_params, false),
AccountMeta::new(a.sol_vault, false),
AccountMeta::new(a.mayhem_state, false),
AccountMeta::new(a.mayhem_token_vault, false),
];
Instruction {
program_id,
accounts,
data,
}
}
}