use borsh::BorshDeserialize;
use borsh::BorshSerialize;
#[derive(Debug)]
pub struct InitializePoolWithAdaptiveFee {
pub whirlpools_config: solana_pubkey::Pubkey,
pub token_mint_a: solana_pubkey::Pubkey,
pub token_mint_b: solana_pubkey::Pubkey,
pub token_badge_a: solana_pubkey::Pubkey,
pub token_badge_b: solana_pubkey::Pubkey,
pub funder: solana_pubkey::Pubkey,
pub initialize_pool_authority: solana_pubkey::Pubkey,
pub whirlpool: solana_pubkey::Pubkey,
pub oracle: solana_pubkey::Pubkey,
pub token_vault_a: solana_pubkey::Pubkey,
pub token_vault_b: solana_pubkey::Pubkey,
pub adaptive_fee_tier: solana_pubkey::Pubkey,
pub token_program_a: solana_pubkey::Pubkey,
pub token_program_b: solana_pubkey::Pubkey,
pub system_program: solana_pubkey::Pubkey,
pub rent: solana_pubkey::Pubkey,
}
impl InitializePoolWithAdaptiveFee {
pub fn instruction(
&self,
args: InitializePoolWithAdaptiveFeeInstructionArgs,
) -> solana_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: InitializePoolWithAdaptiveFeeInstructionArgs,
remaining_accounts: &[solana_instruction::AccountMeta],
) -> solana_instruction::Instruction {
let mut accounts = Vec::with_capacity(16 + remaining_accounts.len());
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.whirlpools_config,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_mint_a,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_mint_b,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_badge_a,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_badge_b,
false,
));
accounts.push(solana_instruction::AccountMeta::new(self.funder, true));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.initialize_pool_authority,
true,
));
accounts.push(solana_instruction::AccountMeta::new(self.whirlpool, false));
accounts.push(solana_instruction::AccountMeta::new(self.oracle, false));
accounts.push(solana_instruction::AccountMeta::new(
self.token_vault_a,
true,
));
accounts.push(solana_instruction::AccountMeta::new(
self.token_vault_b,
true,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.adaptive_fee_tier,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_program_a,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_program_b,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.system_program,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.rent, false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = borsh::to_vec(&InitializePoolWithAdaptiveFeeInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);
solana_instruction::Instruction {
program_id: crate::WHIRLPOOL_ID,
accounts,
data,
}
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct InitializePoolWithAdaptiveFeeInstructionData {
discriminator: [u8; 8],
}
impl InitializePoolWithAdaptiveFeeInstructionData {
pub fn new() -> Self {
Self {
discriminator: [143, 94, 96, 76, 172, 124, 119, 199],
}
}
}
impl Default for InitializePoolWithAdaptiveFeeInstructionData {
fn default() -> Self {
Self::new()
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct InitializePoolWithAdaptiveFeeInstructionArgs {
pub initial_sqrt_price: u128,
pub trade_enable_timestamp: Option<u64>,
}
#[derive(Clone, Debug, Default)]
pub struct InitializePoolWithAdaptiveFeeBuilder {
whirlpools_config: Option<solana_pubkey::Pubkey>,
token_mint_a: Option<solana_pubkey::Pubkey>,
token_mint_b: Option<solana_pubkey::Pubkey>,
token_badge_a: Option<solana_pubkey::Pubkey>,
token_badge_b: Option<solana_pubkey::Pubkey>,
funder: Option<solana_pubkey::Pubkey>,
initialize_pool_authority: Option<solana_pubkey::Pubkey>,
whirlpool: Option<solana_pubkey::Pubkey>,
oracle: Option<solana_pubkey::Pubkey>,
token_vault_a: Option<solana_pubkey::Pubkey>,
token_vault_b: Option<solana_pubkey::Pubkey>,
adaptive_fee_tier: Option<solana_pubkey::Pubkey>,
token_program_a: Option<solana_pubkey::Pubkey>,
token_program_b: Option<solana_pubkey::Pubkey>,
system_program: Option<solana_pubkey::Pubkey>,
rent: Option<solana_pubkey::Pubkey>,
initial_sqrt_price: Option<u128>,
trade_enable_timestamp: Option<u64>,
__remaining_accounts: Vec<solana_instruction::AccountMeta>,
}
impl InitializePoolWithAdaptiveFeeBuilder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn whirlpools_config(&mut self, whirlpools_config: solana_pubkey::Pubkey) -> &mut Self {
self.whirlpools_config = Some(whirlpools_config);
self
}
#[inline(always)]
pub fn token_mint_a(&mut self, token_mint_a: solana_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_pubkey::Pubkey) -> &mut Self {
self.token_mint_b = Some(token_mint_b);
self
}
#[inline(always)]
pub fn token_badge_a(&mut self, token_badge_a: solana_pubkey::Pubkey) -> &mut Self {
self.token_badge_a = Some(token_badge_a);
self
}
#[inline(always)]
pub fn token_badge_b(&mut self, token_badge_b: solana_pubkey::Pubkey) -> &mut Self {
self.token_badge_b = Some(token_badge_b);
self
}
#[inline(always)]
pub fn funder(&mut self, funder: solana_pubkey::Pubkey) -> &mut Self {
self.funder = Some(funder);
self
}
#[inline(always)]
pub fn initialize_pool_authority(
&mut self,
initialize_pool_authority: solana_pubkey::Pubkey,
) -> &mut Self {
self.initialize_pool_authority = Some(initialize_pool_authority);
self
}
#[inline(always)]
pub fn whirlpool(&mut self, whirlpool: solana_pubkey::Pubkey) -> &mut Self {
self.whirlpool = Some(whirlpool);
self
}
#[inline(always)]
pub fn oracle(&mut self, oracle: solana_pubkey::Pubkey) -> &mut Self {
self.oracle = Some(oracle);
self
}
#[inline(always)]
pub fn token_vault_a(&mut self, token_vault_a: solana_pubkey::Pubkey) -> &mut Self {
self.token_vault_a = Some(token_vault_a);
self
}
#[inline(always)]
pub fn token_vault_b(&mut self, token_vault_b: solana_pubkey::Pubkey) -> &mut Self {
self.token_vault_b = Some(token_vault_b);
self
}
#[inline(always)]
pub fn adaptive_fee_tier(&mut self, adaptive_fee_tier: solana_pubkey::Pubkey) -> &mut Self {
self.adaptive_fee_tier = Some(adaptive_fee_tier);
self
}
#[inline(always)]
pub fn token_program_a(&mut self, token_program_a: solana_pubkey::Pubkey) -> &mut Self {
self.token_program_a = Some(token_program_a);
self
}
#[inline(always)]
pub fn token_program_b(&mut self, token_program_b: solana_pubkey::Pubkey) -> &mut Self {
self.token_program_b = Some(token_program_b);
self
}
#[inline(always)]
pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self {
self.system_program = Some(system_program);
self
}
#[inline(always)]
pub fn rent(&mut self, rent: solana_pubkey::Pubkey) -> &mut Self {
self.rent = Some(rent);
self
}
#[inline(always)]
pub fn initial_sqrt_price(&mut self, initial_sqrt_price: u128) -> &mut Self {
self.initial_sqrt_price = Some(initial_sqrt_price);
self
}
#[inline(always)]
pub fn trade_enable_timestamp(&mut self, trade_enable_timestamp: u64) -> &mut Self {
self.trade_enable_timestamp = Some(trade_enable_timestamp);
self
}
#[inline(always)]
pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
self.__remaining_accounts.push(account);
self
}
#[inline(always)]
pub fn add_remaining_accounts(
&mut self,
accounts: &[solana_instruction::AccountMeta],
) -> &mut Self {
self.__remaining_accounts.extend_from_slice(accounts);
self
}
#[allow(clippy::clone_on_copy)]
pub fn instruction(&self) -> solana_instruction::Instruction {
let accounts = InitializePoolWithAdaptiveFee {
whirlpools_config: self
.whirlpools_config
.expect("whirlpools_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"),
token_badge_a: self.token_badge_a.expect("token_badge_a is not set"),
token_badge_b: self.token_badge_b.expect("token_badge_b is not set"),
funder: self.funder.expect("funder is not set"),
initialize_pool_authority: self
.initialize_pool_authority
.expect("initialize_pool_authority is not set"),
whirlpool: self.whirlpool.expect("whirlpool is not set"),
oracle: self.oracle.expect("oracle is not set"),
token_vault_a: self.token_vault_a.expect("token_vault_a is not set"),
token_vault_b: self.token_vault_b.expect("token_vault_b is not set"),
adaptive_fee_tier: self
.adaptive_fee_tier
.expect("adaptive_fee_tier is not set"),
token_program_a: self.token_program_a.expect("token_program_a is not set"),
token_program_b: self.token_program_b.expect("token_program_b is not set"),
system_program: self
.system_program
.unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")),
rent: self.rent.unwrap_or(solana_pubkey::pubkey!(
"SysvarRent111111111111111111111111111111111"
)),
};
let args = InitializePoolWithAdaptiveFeeInstructionArgs {
initial_sqrt_price: self
.initial_sqrt_price
.clone()
.expect("initial_sqrt_price is not set"),
trade_enable_timestamp: self.trade_enable_timestamp.clone(),
};
accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
}
}
pub struct InitializePoolWithAdaptiveFeeCpiAccounts<'a, 'b> {
pub whirlpools_config: &'b solana_account_info::AccountInfo<'a>,
pub token_mint_a: &'b solana_account_info::AccountInfo<'a>,
pub token_mint_b: &'b solana_account_info::AccountInfo<'a>,
pub token_badge_a: &'b solana_account_info::AccountInfo<'a>,
pub token_badge_b: &'b solana_account_info::AccountInfo<'a>,
pub funder: &'b solana_account_info::AccountInfo<'a>,
pub initialize_pool_authority: &'b solana_account_info::AccountInfo<'a>,
pub whirlpool: &'b solana_account_info::AccountInfo<'a>,
pub oracle: &'b solana_account_info::AccountInfo<'a>,
pub token_vault_a: &'b solana_account_info::AccountInfo<'a>,
pub token_vault_b: &'b solana_account_info::AccountInfo<'a>,
pub adaptive_fee_tier: &'b solana_account_info::AccountInfo<'a>,
pub token_program_a: &'b solana_account_info::AccountInfo<'a>,
pub token_program_b: &'b solana_account_info::AccountInfo<'a>,
pub system_program: &'b solana_account_info::AccountInfo<'a>,
pub rent: &'b solana_account_info::AccountInfo<'a>,
}
pub struct InitializePoolWithAdaptiveFeeCpi<'a, 'b> {
pub __program: &'b solana_account_info::AccountInfo<'a>,
pub whirlpools_config: &'b solana_account_info::AccountInfo<'a>,
pub token_mint_a: &'b solana_account_info::AccountInfo<'a>,
pub token_mint_b: &'b solana_account_info::AccountInfo<'a>,
pub token_badge_a: &'b solana_account_info::AccountInfo<'a>,
pub token_badge_b: &'b solana_account_info::AccountInfo<'a>,
pub funder: &'b solana_account_info::AccountInfo<'a>,
pub initialize_pool_authority: &'b solana_account_info::AccountInfo<'a>,
pub whirlpool: &'b solana_account_info::AccountInfo<'a>,
pub oracle: &'b solana_account_info::AccountInfo<'a>,
pub token_vault_a: &'b solana_account_info::AccountInfo<'a>,
pub token_vault_b: &'b solana_account_info::AccountInfo<'a>,
pub adaptive_fee_tier: &'b solana_account_info::AccountInfo<'a>,
pub token_program_a: &'b solana_account_info::AccountInfo<'a>,
pub token_program_b: &'b solana_account_info::AccountInfo<'a>,
pub system_program: &'b solana_account_info::AccountInfo<'a>,
pub rent: &'b solana_account_info::AccountInfo<'a>,
pub __args: InitializePoolWithAdaptiveFeeInstructionArgs,
}
impl<'a, 'b> InitializePoolWithAdaptiveFeeCpi<'a, 'b> {
pub fn new(
program: &'b solana_account_info::AccountInfo<'a>,
accounts: InitializePoolWithAdaptiveFeeCpiAccounts<'a, 'b>,
args: InitializePoolWithAdaptiveFeeInstructionArgs,
) -> Self {
Self {
__program: program,
whirlpools_config: accounts.whirlpools_config,
token_mint_a: accounts.token_mint_a,
token_mint_b: accounts.token_mint_b,
token_badge_a: accounts.token_badge_a,
token_badge_b: accounts.token_badge_b,
funder: accounts.funder,
initialize_pool_authority: accounts.initialize_pool_authority,
whirlpool: accounts.whirlpool,
oracle: accounts.oracle,
token_vault_a: accounts.token_vault_a,
token_vault_b: accounts.token_vault_b,
adaptive_fee_tier: accounts.adaptive_fee_tier,
token_program_a: accounts.token_program_a,
token_program_b: accounts.token_program_b,
system_program: accounts.system_program,
rent: accounts.rent,
__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_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_account_info::AccountInfo<'a>, bool, bool)],
) -> solana_program_entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(16 + remaining_accounts.len());
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.whirlpools_config.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_mint_a.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_mint_b.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_badge_a.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_badge_b.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(*self.funder.key, true));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.initialize_pool_authority.key,
true,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.whirlpool.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.oracle.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.token_vault_a.key,
true,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.token_vault_b.key,
true,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.adaptive_fee_tier.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_program_a.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_program_b.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.system_program.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.rent.key,
false,
));
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_signer: remaining_account.1,
is_writable: remaining_account.2,
})
});
let mut data = borsh::to_vec(&InitializePoolWithAdaptiveFeeInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);
let instruction = solana_instruction::Instruction {
program_id: crate::WHIRLPOOL_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(17 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.whirlpools_config.clone());
account_infos.push(self.token_mint_a.clone());
account_infos.push(self.token_mint_b.clone());
account_infos.push(self.token_badge_a.clone());
account_infos.push(self.token_badge_b.clone());
account_infos.push(self.funder.clone());
account_infos.push(self.initialize_pool_authority.clone());
account_infos.push(self.whirlpool.clone());
account_infos.push(self.oracle.clone());
account_infos.push(self.token_vault_a.clone());
account_infos.push(self.token_vault_b.clone());
account_infos.push(self.adaptive_fee_tier.clone());
account_infos.push(self.token_program_a.clone());
account_infos.push(self.token_program_b.clone());
account_infos.push(self.system_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_cpi::invoke(&instruction, &account_infos)
} else {
solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
}
}
}
#[derive(Clone, Debug)]
pub struct InitializePoolWithAdaptiveFeeCpiBuilder<'a, 'b> {
instruction: Box<InitializePoolWithAdaptiveFeeCpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> InitializePoolWithAdaptiveFeeCpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(InitializePoolWithAdaptiveFeeCpiBuilderInstruction {
__program: program,
whirlpools_config: None,
token_mint_a: None,
token_mint_b: None,
token_badge_a: None,
token_badge_b: None,
funder: None,
initialize_pool_authority: None,
whirlpool: None,
oracle: None,
token_vault_a: None,
token_vault_b: None,
adaptive_fee_tier: None,
token_program_a: None,
token_program_b: None,
system_program: None,
rent: None,
initial_sqrt_price: None,
trade_enable_timestamp: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[inline(always)]
pub fn whirlpools_config(
&mut self,
whirlpools_config: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.whirlpools_config = Some(whirlpools_config);
self
}
#[inline(always)]
pub fn token_mint_a(
&mut self,
token_mint_a: &'b solana_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_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_mint_b = Some(token_mint_b);
self
}
#[inline(always)]
pub fn token_badge_a(
&mut self,
token_badge_a: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_badge_a = Some(token_badge_a);
self
}
#[inline(always)]
pub fn token_badge_b(
&mut self,
token_badge_b: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_badge_b = Some(token_badge_b);
self
}
#[inline(always)]
pub fn funder(&mut self, funder: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.funder = Some(funder);
self
}
#[inline(always)]
pub fn initialize_pool_authority(
&mut self,
initialize_pool_authority: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.initialize_pool_authority = Some(initialize_pool_authority);
self
}
#[inline(always)]
pub fn whirlpool(&mut self, whirlpool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.whirlpool = Some(whirlpool);
self
}
#[inline(always)]
pub fn oracle(&mut self, oracle: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.oracle = Some(oracle);
self
}
#[inline(always)]
pub fn token_vault_a(
&mut self,
token_vault_a: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_vault_a = Some(token_vault_a);
self
}
#[inline(always)]
pub fn token_vault_b(
&mut self,
token_vault_b: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_vault_b = Some(token_vault_b);
self
}
#[inline(always)]
pub fn adaptive_fee_tier(
&mut self,
adaptive_fee_tier: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.adaptive_fee_tier = Some(adaptive_fee_tier);
self
}
#[inline(always)]
pub fn token_program_a(
&mut self,
token_program_a: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_program_a = Some(token_program_a);
self
}
#[inline(always)]
pub fn token_program_b(
&mut self,
token_program_b: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_program_b = Some(token_program_b);
self
}
#[inline(always)]
pub fn system_program(
&mut self,
system_program: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.system_program = Some(system_program);
self
}
#[inline(always)]
pub fn rent(&mut self, rent: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.rent = Some(rent);
self
}
#[inline(always)]
pub fn initial_sqrt_price(&mut self, initial_sqrt_price: u128) -> &mut Self {
self.instruction.initial_sqrt_price = Some(initial_sqrt_price);
self
}
#[inline(always)]
pub fn trade_enable_timestamp(&mut self, trade_enable_timestamp: u64) -> &mut Self {
self.instruction.trade_enable_timestamp = Some(trade_enable_timestamp);
self
}
#[inline(always)]
pub fn add_remaining_account(
&mut self,
account: &'b solana_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_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 = InitializePoolWithAdaptiveFeeInstructionArgs {
initial_sqrt_price: self
.instruction
.initial_sqrt_price
.clone()
.expect("initial_sqrt_price is not set"),
trade_enable_timestamp: self.instruction.trade_enable_timestamp.clone(),
};
let instruction = InitializePoolWithAdaptiveFeeCpi {
__program: self.instruction.__program,
whirlpools_config: self
.instruction
.whirlpools_config
.expect("whirlpools_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"),
token_badge_a: self
.instruction
.token_badge_a
.expect("token_badge_a is not set"),
token_badge_b: self
.instruction
.token_badge_b
.expect("token_badge_b is not set"),
funder: self.instruction.funder.expect("funder is not set"),
initialize_pool_authority: self
.instruction
.initialize_pool_authority
.expect("initialize_pool_authority is not set"),
whirlpool: self.instruction.whirlpool.expect("whirlpool is not set"),
oracle: self.instruction.oracle.expect("oracle is not set"),
token_vault_a: self
.instruction
.token_vault_a
.expect("token_vault_a is not set"),
token_vault_b: self
.instruction
.token_vault_b
.expect("token_vault_b is not set"),
adaptive_fee_tier: self
.instruction
.adaptive_fee_tier
.expect("adaptive_fee_tier is not set"),
token_program_a: self
.instruction
.token_program_a
.expect("token_program_a is not set"),
token_program_b: self
.instruction
.token_program_b
.expect("token_program_b is not set"),
system_program: self
.instruction
.system_program
.expect("system_program is not set"),
rent: self.instruction.rent.expect("rent is not set"),
__args: args,
};
instruction.invoke_signed_with_remaining_accounts(
signers_seeds,
&self.instruction.__remaining_accounts,
)
}
}
#[derive(Clone, Debug)]
struct InitializePoolWithAdaptiveFeeCpiBuilderInstruction<'a, 'b> {
__program: &'b solana_account_info::AccountInfo<'a>,
whirlpools_config: Option<&'b solana_account_info::AccountInfo<'a>>,
token_mint_a: Option<&'b solana_account_info::AccountInfo<'a>>,
token_mint_b: Option<&'b solana_account_info::AccountInfo<'a>>,
token_badge_a: Option<&'b solana_account_info::AccountInfo<'a>>,
token_badge_b: Option<&'b solana_account_info::AccountInfo<'a>>,
funder: Option<&'b solana_account_info::AccountInfo<'a>>,
initialize_pool_authority: Option<&'b solana_account_info::AccountInfo<'a>>,
whirlpool: Option<&'b solana_account_info::AccountInfo<'a>>,
oracle: Option<&'b solana_account_info::AccountInfo<'a>>,
token_vault_a: Option<&'b solana_account_info::AccountInfo<'a>>,
token_vault_b: Option<&'b solana_account_info::AccountInfo<'a>>,
adaptive_fee_tier: Option<&'b solana_account_info::AccountInfo<'a>>,
token_program_a: Option<&'b solana_account_info::AccountInfo<'a>>,
token_program_b: Option<&'b solana_account_info::AccountInfo<'a>>,
system_program: Option<&'b solana_account_info::AccountInfo<'a>>,
rent: Option<&'b solana_account_info::AccountInfo<'a>>,
initial_sqrt_price: Option<u128>,
trade_enable_timestamp: Option<u64>,
__remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
}