use borsh::BorshSerialize;
use borsh::BorshDeserialize;
#[derive(Debug)]
pub struct GraduateLpPosition {
pub funder: solana_program::pubkey::Pubkey,
pub vortex_config: solana_program::pubkey::Pubkey,
pub vortex: solana_program::pubkey::Pubkey,
pub cyclone: solana_program::pubkey::Pubkey,
pub collect_lp_fees_authority: solana_program::pubkey::Pubkey,
pub position: solana_program::pubkey::Pubkey,
pub position_mint: solana_program::pubkey::Pubkey,
pub position_token_account: solana_program::pubkey::Pubkey,
pub tick_array_lower: solana_program::pubkey::Pubkey,
pub tick_array_upper: solana_program::pubkey::Pubkey,
pub token_program: solana_program::pubkey::Pubkey,
pub system_program: solana_program::pubkey::Pubkey,
pub associated_token_program: solana_program::pubkey::Pubkey,
pub rent: solana_program::pubkey::Pubkey,
}
impl GraduateLpPosition {
pub fn instruction(&self) -> solana_program::instruction::Instruction {
self.instruction_with_remaining_accounts(&[])
}
#[allow(clippy::arithmetic_side_effects)]
#[allow(clippy::vec_init_then_push)]
pub fn instruction_with_remaining_accounts(&self, remaining_accounts: &[solana_program::instruction::AccountMeta]) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(14+ remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new(
self.funder,
true
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.vortex_config,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.vortex,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.cyclone,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.collect_lp_fees_authority,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.position,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.position_mint,
true
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.position_token_account,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.tick_array_lower,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.tick_array_upper,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.token_program,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.system_program,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.associated_token_program,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.rent,
false
));
accounts.extend_from_slice(remaining_accounts);
let data = borsh::to_vec(&GraduateLpPositionInstructionData::new()).unwrap();
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 GraduateLpPositionInstructionData {
discriminator: [u8; 8],
}
impl GraduateLpPositionInstructionData {
pub fn new() -> Self {
Self {
discriminator: [237, 99, 47, 27, 245, 121, 94, 249],
}
}
}
impl Default for GraduateLpPositionInstructionData {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Default)]
pub struct GraduateLpPositionBuilder {
funder: Option<solana_program::pubkey::Pubkey>,
vortex_config: Option<solana_program::pubkey::Pubkey>,
vortex: Option<solana_program::pubkey::Pubkey>,
cyclone: Option<solana_program::pubkey::Pubkey>,
collect_lp_fees_authority: Option<solana_program::pubkey::Pubkey>,
position: Option<solana_program::pubkey::Pubkey>,
position_mint: Option<solana_program::pubkey::Pubkey>,
position_token_account: Option<solana_program::pubkey::Pubkey>,
tick_array_lower: Option<solana_program::pubkey::Pubkey>,
tick_array_upper: Option<solana_program::pubkey::Pubkey>,
token_program: Option<solana_program::pubkey::Pubkey>,
system_program: Option<solana_program::pubkey::Pubkey>,
associated_token_program: Option<solana_program::pubkey::Pubkey>,
rent: Option<solana_program::pubkey::Pubkey>,
__remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
}
impl GraduateLpPositionBuilder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn funder(&mut self, funder: solana_program::pubkey::Pubkey) -> &mut Self {
self.funder = Some(funder);
self
}
#[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 vortex(&mut self, vortex: solana_program::pubkey::Pubkey) -> &mut Self {
self.vortex = Some(vortex);
self
}
#[inline(always)]
pub fn cyclone(&mut self, cyclone: solana_program::pubkey::Pubkey) -> &mut Self {
self.cyclone = Some(cyclone);
self
}
#[inline(always)]
pub fn collect_lp_fees_authority(&mut self, collect_lp_fees_authority: solana_program::pubkey::Pubkey) -> &mut Self {
self.collect_lp_fees_authority = Some(collect_lp_fees_authority);
self
}
#[inline(always)]
pub fn position(&mut self, position: solana_program::pubkey::Pubkey) -> &mut Self {
self.position = Some(position);
self
}
#[inline(always)]
pub fn position_mint(&mut self, position_mint: solana_program::pubkey::Pubkey) -> &mut Self {
self.position_mint = Some(position_mint);
self
}
#[inline(always)]
pub fn position_token_account(&mut self, position_token_account: solana_program::pubkey::Pubkey) -> &mut Self {
self.position_token_account = Some(position_token_account);
self
}
#[inline(always)]
pub fn tick_array_lower(&mut self, tick_array_lower: solana_program::pubkey::Pubkey) -> &mut Self {
self.tick_array_lower = Some(tick_array_lower);
self
}
#[inline(always)]
pub fn tick_array_upper(&mut self, tick_array_upper: solana_program::pubkey::Pubkey) -> &mut Self {
self.tick_array_upper = Some(tick_array_upper);
self
}
#[inline(always)]
pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
self.token_program = Some(token_program);
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 associated_token_program(&mut self, associated_token_program: solana_program::pubkey::Pubkey) -> &mut Self {
self.associated_token_program = Some(associated_token_program);
self
}
#[inline(always)]
pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self {
self.rent = Some(rent);
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 = GraduateLpPosition {
funder: self.funder.expect("funder is not set"),
vortex_config: self.vortex_config.expect("vortex_config is not set"),
vortex: self.vortex.expect("vortex is not set"),
cyclone: self.cyclone.expect("cyclone is not set"),
collect_lp_fees_authority: self.collect_lp_fees_authority.expect("collect_lp_fees_authority is not set"),
position: self.position.expect("position is not set"),
position_mint: self.position_mint.expect("position_mint is not set"),
position_token_account: self.position_token_account.expect("position_token_account is not set"),
tick_array_lower: self.tick_array_lower.expect("tick_array_lower is not set"),
tick_array_upper: self.tick_array_upper.expect("tick_array_upper is not set"),
token_program: self.token_program.unwrap_or(solana_program::pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")),
system_program: self.system_program.unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
associated_token_program: self.associated_token_program.expect("associated_token_program is not set"),
rent: self.rent.unwrap_or(solana_program::pubkey!("SysvarRent111111111111111111111111111111111")),
};
accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
}
}
pub struct GraduateLpPositionCpiAccounts<'a, 'b> {
pub funder: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex_config: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex: &'b solana_program::account_info::AccountInfo<'a>,
pub cyclone: &'b solana_program::account_info::AccountInfo<'a>,
pub collect_lp_fees_authority: &'b solana_program::account_info::AccountInfo<'a>,
pub position: &'b solana_program::account_info::AccountInfo<'a>,
pub position_mint: &'b solana_program::account_info::AccountInfo<'a>,
pub position_token_account: &'b solana_program::account_info::AccountInfo<'a>,
pub tick_array_lower: &'b solana_program::account_info::AccountInfo<'a>,
pub tick_array_upper: &'b solana_program::account_info::AccountInfo<'a>,
pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
pub rent: &'b solana_program::account_info::AccountInfo<'a>,
}
pub struct GraduateLpPositionCpi<'a, 'b> {
pub __program: &'b solana_program::account_info::AccountInfo<'a>,
pub funder: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex_config: &'b solana_program::account_info::AccountInfo<'a>,
pub vortex: &'b solana_program::account_info::AccountInfo<'a>,
pub cyclone: &'b solana_program::account_info::AccountInfo<'a>,
pub collect_lp_fees_authority: &'b solana_program::account_info::AccountInfo<'a>,
pub position: &'b solana_program::account_info::AccountInfo<'a>,
pub position_mint: &'b solana_program::account_info::AccountInfo<'a>,
pub position_token_account: &'b solana_program::account_info::AccountInfo<'a>,
pub tick_array_lower: &'b solana_program::account_info::AccountInfo<'a>,
pub tick_array_upper: &'b solana_program::account_info::AccountInfo<'a>,
pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
pub rent: &'b solana_program::account_info::AccountInfo<'a>,
}
impl<'a, 'b> GraduateLpPositionCpi<'a, 'b> {
pub fn new(
program: &'b solana_program::account_info::AccountInfo<'a>,
accounts: GraduateLpPositionCpiAccounts<'a, 'b>,
) -> Self {
Self {
__program: program,
funder: accounts.funder,
vortex_config: accounts.vortex_config,
vortex: accounts.vortex,
cyclone: accounts.cyclone,
collect_lp_fees_authority: accounts.collect_lp_fees_authority,
position: accounts.position,
position_mint: accounts.position_mint,
position_token_account: accounts.position_token_account,
tick_array_lower: accounts.tick_array_lower,
tick_array_upper: accounts.tick_array_upper,
token_program: accounts.token_program,
system_program: accounts.system_program,
associated_token_program: accounts.associated_token_program,
rent: accounts.rent,
}
}
#[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(14+ remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new(
*self.funder.key,
true
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.vortex_config.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.vortex.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.cyclone.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.collect_lp_fees_authority.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.position.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.position_mint.key,
true
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.position_token_account.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.tick_array_lower.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.tick_array_upper.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.token_program.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.system_program.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.associated_token_program.key,
false
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.rent.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 data = borsh::to_vec(&GraduateLpPositionInstructionData::new()).unwrap();
let instruction = solana_program::instruction::Instruction {
program_id: crate::VORTEX_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(15 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.funder.clone());
account_infos.push(self.vortex_config.clone());
account_infos.push(self.vortex.clone());
account_infos.push(self.cyclone.clone());
account_infos.push(self.collect_lp_fees_authority.clone());
account_infos.push(self.position.clone());
account_infos.push(self.position_mint.clone());
account_infos.push(self.position_token_account.clone());
account_infos.push(self.tick_array_lower.clone());
account_infos.push(self.tick_array_upper.clone());
account_infos.push(self.token_program.clone());
account_infos.push(self.system_program.clone());
account_infos.push(self.associated_token_program.clone());
account_infos.push(self.rent.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 GraduateLpPositionCpiBuilder<'a, 'b> {
instruction: Box<GraduateLpPositionCpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> GraduateLpPositionCpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(GraduateLpPositionCpiBuilderInstruction {
__program: program,
funder: None,
vortex_config: None,
vortex: None,
cyclone: None,
collect_lp_fees_authority: None,
position: None,
position_mint: None,
position_token_account: None,
tick_array_lower: None,
tick_array_upper: None,
token_program: None,
system_program: None,
associated_token_program: None,
rent: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[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 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 vortex(&mut self, vortex: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.vortex = Some(vortex);
self
}
#[inline(always)]
pub fn cyclone(&mut self, cyclone: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.cyclone = Some(cyclone);
self
}
#[inline(always)]
pub fn collect_lp_fees_authority(&mut self, collect_lp_fees_authority: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.collect_lp_fees_authority = Some(collect_lp_fees_authority);
self
}
#[inline(always)]
pub fn position(&mut self, position: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.position = Some(position);
self
}
#[inline(always)]
pub fn position_mint(&mut self, position_mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.position_mint = Some(position_mint);
self
}
#[inline(always)]
pub fn position_token_account(&mut self, position_token_account: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.position_token_account = Some(position_token_account);
self
}
#[inline(always)]
pub fn tick_array_lower(&mut self, tick_array_lower: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.tick_array_lower = Some(tick_array_lower);
self
}
#[inline(always)]
pub fn tick_array_upper(&mut self, tick_array_upper: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.tick_array_upper = Some(tick_array_upper);
self
}
#[inline(always)]
pub fn token_program(&mut self, token_program: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.token_program = Some(token_program);
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 associated_token_program(&mut self, associated_token_program: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.associated_token_program = Some(associated_token_program);
self
}
#[inline(always)]
pub fn rent(&mut self, rent: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.rent = Some(rent);
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 instruction = GraduateLpPositionCpi {
__program: self.instruction.__program,
funder: self.instruction.funder.expect("funder is not set"),
vortex_config: self.instruction.vortex_config.expect("vortex_config is not set"),
vortex: self.instruction.vortex.expect("vortex is not set"),
cyclone: self.instruction.cyclone.expect("cyclone is not set"),
collect_lp_fees_authority: self.instruction.collect_lp_fees_authority.expect("collect_lp_fees_authority is not set"),
position: self.instruction.position.expect("position is not set"),
position_mint: self.instruction.position_mint.expect("position_mint is not set"),
position_token_account: self.instruction.position_token_account.expect("position_token_account is not set"),
tick_array_lower: self.instruction.tick_array_lower.expect("tick_array_lower is not set"),
tick_array_upper: self.instruction.tick_array_upper.expect("tick_array_upper is not set"),
token_program: self.instruction.token_program.expect("token_program is not set"),
system_program: self.instruction.system_program.expect("system_program is not set"),
associated_token_program: self.instruction.associated_token_program.expect("associated_token_program is not set"),
rent: self.instruction.rent.expect("rent is not set"),
};
instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
}
}
#[derive(Clone, Debug)]
struct GraduateLpPositionCpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
funder: Option<&'b solana_program::account_info::AccountInfo<'a>>,
vortex_config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
vortex: Option<&'b solana_program::account_info::AccountInfo<'a>>,
cyclone: Option<&'b solana_program::account_info::AccountInfo<'a>>,
collect_lp_fees_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
position: Option<&'b solana_program::account_info::AccountInfo<'a>>,
position_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
position_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
tick_array_lower: Option<&'b solana_program::account_info::AccountInfo<'a>>,
tick_array_upper: Option<&'b solana_program::account_info::AccountInfo<'a>>,
token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
rent: Option<&'b solana_program::account_info::AccountInfo<'a>>,
__remaining_accounts: Vec<(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)>,
}