use borsh::BorshSerialize;
use borsh::BorshDeserialize;
#[derive(Debug)]
pub struct InitializeGraduationTickArray {
pub vortex_config: solana_program::pubkey::Pubkey,
pub token_mint_a: solana_program::pubkey::Pubkey,
pub token_mint_b: solana_program::pubkey::Pubkey,
pub vortex: solana_program::pubkey::Pubkey,
pub funder: solana_program::pubkey::Pubkey,
pub tick_array: solana_program::pubkey::Pubkey,
pub system_program: solana_program::pubkey::Pubkey,
}
impl InitializeGraduationTickArray {
pub fn instruction(&self, args: InitializeGraduationTickArrayInstructionArgs) -> solana_program::instruction::Instruction {
self.instruction_with_remaining_accounts(args, &[])
}
#[allow(clippy::arithmetic_side_effects)]
#[allow(clippy::vec_init_then_push)]
pub fn instruction_with_remaining_accounts(&self, args: InitializeGraduationTickArrayInstructionArgs, remaining_accounts: &[solana_program::instruction::AccountMeta]) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(7+ remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.vortex_config,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.token_mint_a,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.token_mint_b,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.vortex,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.funder,
true
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.tick_array,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.system_program,
false
));
accounts.extend_from_slice(remaining_accounts);
let mut data = borsh::to_vec(&InitializeGraduationTickArrayInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);
solana_program::instruction::Instruction {
program_id: crate::VORTEX_ID,
accounts,
data,
}
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct InitializeGraduationTickArrayInstructionData {
discriminator: [u8; 8],
}
impl InitializeGraduationTickArrayInstructionData {
pub fn new() -> Self {
Self {
discriminator: [61, 252, 135, 131, 164, 57, 161, 159],
}
}
}
impl Default for InitializeGraduationTickArrayInstructionData {
fn default() -> Self {
Self::new()
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct InitializeGraduationTickArrayInstructionArgs {
pub start_tick_index: i32,
}
#[derive(Clone, Debug, Default)]
pub struct InitializeGraduationTickArrayBuilder {
vortex_config: Option<solana_program::pubkey::Pubkey>,
token_mint_a: Option<solana_program::pubkey::Pubkey>,
token_mint_b: Option<solana_program::pubkey::Pubkey>,
vortex: Option<solana_program::pubkey::Pubkey>,
funder: Option<solana_program::pubkey::Pubkey>,
tick_array: Option<solana_program::pubkey::Pubkey>,
system_program: Option<solana_program::pubkey::Pubkey>,
start_tick_index: Option<i32>,
__remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
}
impl InitializeGraduationTickArrayBuilder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn vortex_config(&mut self, vortex_config: solana_program::pubkey::Pubkey) -> &mut Self {
self.vortex_config = Some(vortex_config);
self
}
#[inline(always)]
pub fn token_mint_a(&mut self, token_mint_a: solana_program::pubkey::Pubkey) -> &mut Self {
self.token_mint_a = Some(token_mint_a);
self
}
#[inline(always)]
pub fn token_mint_b(&mut self, token_mint_b: solana_program::pubkey::Pubkey) -> &mut Self {
self.token_mint_b = Some(token_mint_b);
self
}
#[inline(always)]
pub fn vortex(&mut self, vortex: solana_program::pubkey::Pubkey) -> &mut Self {
self.vortex = Some(vortex);
self
}
#[inline(always)]
pub fn funder(&mut self, funder: solana_program::pubkey::Pubkey) -> &mut Self {
self.funder = Some(funder);
self
}
#[inline(always)]
pub fn tick_array(&mut self, tick_array: solana_program::pubkey::Pubkey) -> &mut Self {
self.tick_array = Some(tick_array);
self
}
#[inline(always)]
pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
self.system_program = Some(system_program);
self
}
#[inline(always)]
pub fn start_tick_index(&mut self, start_tick_index: i32) -> &mut Self {
self.start_tick_index = Some(start_tick_index);
self
}
#[inline(always)]
pub fn add_remaining_account(&mut self, account: solana_program::instruction::AccountMeta) -> &mut Self {
self.__remaining_accounts.push(account);
self
}
#[inline(always)]
pub fn add_remaining_accounts(&mut self, accounts: &[solana_program::instruction::AccountMeta]) -> &mut Self {
self.__remaining_accounts.extend_from_slice(accounts);
self
}
#[allow(clippy::clone_on_copy)]
pub fn instruction(&self) -> solana_program::instruction::Instruction {
let accounts = InitializeGraduationTickArray {
vortex_config: self.vortex_config.expect("vortex_config is not set"),
token_mint_a: self.token_mint_a.expect("token_mint_a is not set"),
token_mint_b: self.token_mint_b.expect("token_mint_b is not set"),
vortex: self.vortex.expect("vortex is not set"),
funder: self.funder.expect("funder is not set"),
tick_array: self.tick_array.expect("tick_array is not set"),
system_program: self.system_program.unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
};
let args = InitializeGraduationTickArrayInstructionArgs {
start_tick_index: self.start_tick_index.clone().expect("start_tick_index is not set"),
};
accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
}
}
pub struct InitializeGraduationTickArrayCpiAccounts<'a, 'b> {
pub vortex_config: &'b solana_program::account_info::AccountInfo<'a>,
pub token_mint_a: &'b solana_program::account_info::AccountInfo<'a>,
pub token_mint_b: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex: &'b solana_program::account_info::AccountInfo<'a>,
pub funder: &'b solana_program::account_info::AccountInfo<'a>,
pub tick_array: &'b solana_program::account_info::AccountInfo<'a>,
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
}
pub struct InitializeGraduationTickArrayCpi<'a, 'b> {
pub __program: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex_config: &'b solana_program::account_info::AccountInfo<'a>,
pub token_mint_a: &'b solana_program::account_info::AccountInfo<'a>,
pub token_mint_b: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex: &'b solana_program::account_info::AccountInfo<'a>,
pub funder: &'b solana_program::account_info::AccountInfo<'a>,
pub tick_array: &'b solana_program::account_info::AccountInfo<'a>,
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
pub __args: InitializeGraduationTickArrayInstructionArgs,
}
impl<'a, 'b> InitializeGraduationTickArrayCpi<'a, 'b> {
pub fn new(
program: &'b solana_program::account_info::AccountInfo<'a>,
accounts: InitializeGraduationTickArrayCpiAccounts<'a, 'b>,
args: InitializeGraduationTickArrayInstructionArgs,
) -> Self {
Self {
__program: program,
vortex_config: accounts.vortex_config,
token_mint_a: accounts.token_mint_a,
token_mint_b: accounts.token_mint_b,
vortex: accounts.vortex,
funder: accounts.funder,
tick_array: accounts.tick_array,
system_program: accounts.system_program,
__args: args,
}
}
#[inline(always)]
pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed_with_remaining_accounts(&[], &[])
}
#[inline(always)]
pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)]) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
}
#[inline(always)]
pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
}
#[allow(clippy::arithmetic_side_effects)]
#[allow(clippy::clone_on_copy)]
#[allow(clippy::vec_init_then_push)]
pub fn invoke_signed_with_remaining_accounts(
&self,
signers_seeds: &[&[&[u8]]],
remaining_accounts: &[(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)]
) -> solana_program::entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(7+ remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.vortex_config.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.token_mint_a.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.token_mint_b.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.vortex.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.funder.key,
true
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.tick_array.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.system_program.key,
false
));
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_signer: remaining_account.1,
is_writable: remaining_account.2,
})
});
let mut data = borsh::to_vec(&InitializeGraduationTickArrayInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);
let instruction = solana_program::instruction::Instruction {
program_id: crate::VORTEX_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(8 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.vortex_config.clone());
account_infos.push(self.token_mint_a.clone());
account_infos.push(self.token_mint_b.clone());
account_infos.push(self.vortex.clone());
account_infos.push(self.funder.clone());
account_infos.push(self.tick_array.clone());
account_infos.push(self.system_program.clone());
remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
if signers_seeds.is_empty() {
solana_program::program::invoke(&instruction, &account_infos)
} else {
solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
}
}
}
#[derive(Clone, Debug)]
pub struct InitializeGraduationTickArrayCpiBuilder<'a, 'b> {
instruction: Box<InitializeGraduationTickArrayCpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> InitializeGraduationTickArrayCpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(InitializeGraduationTickArrayCpiBuilderInstruction {
__program: program,
vortex_config: None,
token_mint_a: None,
token_mint_b: None,
vortex: None,
funder: None,
tick_array: None,
system_program: None,
start_tick_index: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[inline(always)]
pub fn vortex_config(&mut self, vortex_config: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.vortex_config = Some(vortex_config);
self
}
#[inline(always)]
pub fn token_mint_a(&mut self, token_mint_a: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.token_mint_a = Some(token_mint_a);
self
}
#[inline(always)]
pub fn token_mint_b(&mut self, token_mint_b: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.token_mint_b = Some(token_mint_b);
self
}
#[inline(always)]
pub fn vortex(&mut self, vortex: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.vortex = Some(vortex);
self
}
#[inline(always)]
pub fn funder(&mut self, funder: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.funder = Some(funder);
self
}
#[inline(always)]
pub fn tick_array(&mut self, tick_array: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.tick_array = Some(tick_array);
self
}
#[inline(always)]
pub fn system_program(&mut self, system_program: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.system_program = Some(system_program);
self
}
#[inline(always)]
pub fn start_tick_index(&mut self, start_tick_index: i32) -> &mut Self {
self.instruction.start_tick_index = Some(start_tick_index);
self
}
#[inline(always)]
pub fn add_remaining_account(&mut self, account: &'b solana_program::account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
self
}
#[inline(always)]
pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
self.instruction.__remaining_accounts.extend_from_slice(accounts);
self
}
#[inline(always)]
pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed(&[])
}
#[allow(clippy::clone_on_copy)]
#[allow(clippy::vec_init_then_push)]
pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program::entrypoint::ProgramResult {
let args = InitializeGraduationTickArrayInstructionArgs {
start_tick_index: self.instruction.start_tick_index.clone().expect("start_tick_index is not set"),
};
let instruction = InitializeGraduationTickArrayCpi {
__program: self.instruction.__program,
vortex_config: self.instruction.vortex_config.expect("vortex_config is not set"),
token_mint_a: self.instruction.token_mint_a.expect("token_mint_a is not set"),
token_mint_b: self.instruction.token_mint_b.expect("token_mint_b is not set"),
vortex: self.instruction.vortex.expect("vortex is not set"),
funder: self.instruction.funder.expect("funder is not set"),
tick_array: self.instruction.tick_array.expect("tick_array is not set"),
system_program: self.instruction.system_program.expect("system_program is not set"),
__args: args,
};
instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
}
}
#[derive(Clone, Debug)]
struct InitializeGraduationTickArrayCpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
vortex_config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
token_mint_a: Option<&'b solana_program::account_info::AccountInfo<'a>>,
token_mint_b: Option<&'b solana_program::account_info::AccountInfo<'a>>,
vortex: Option<&'b solana_program::account_info::AccountInfo<'a>>,
funder: Option<&'b solana_program::account_info::AccountInfo<'a>>,
tick_array: Option<&'b solana_program::account_info::AccountInfo<'a>>,
system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
start_tick_index: Option<i32>,
__remaining_accounts: Vec<(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)>,
}