use borsh::BorshDeserialize;
use borsh::BorshSerialize;
#[derive(Debug)]
pub struct Deposit {
pub token_program: solana_pubkey::Pubkey,
pub amm: solana_pubkey::Pubkey,
pub amm_authority: solana_pubkey::Pubkey,
pub amm_open_orders: solana_pubkey::Pubkey,
pub amm_target_orders: solana_pubkey::Pubkey,
pub lp_mint_address: solana_pubkey::Pubkey,
pub pool_coin_token_account: solana_pubkey::Pubkey,
pub pool_pc_token_account: solana_pubkey::Pubkey,
pub serum_market: solana_pubkey::Pubkey,
pub user_coin_token_account: solana_pubkey::Pubkey,
pub user_pc_token_account: solana_pubkey::Pubkey,
pub user_lp_token_account: solana_pubkey::Pubkey,
pub user_owner: solana_pubkey::Pubkey,
pub serum_event_queue: solana_pubkey::Pubkey,
}
impl Deposit {
pub fn instruction(&self, args: DepositInstructionArgs) -> 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: DepositInstructionArgs,
remaining_accounts: &[solana_instruction::AccountMeta],
) -> solana_instruction::Instruction {
let mut accounts = Vec::with_capacity(14 + remaining_accounts.len());
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.token_program,
false,
));
accounts.push(solana_instruction::AccountMeta::new(self.amm, false));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.amm_authority,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.amm_open_orders,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.amm_target_orders,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.lp_mint_address,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.pool_coin_token_account,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.pool_pc_token_account,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.serum_market,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.user_coin_token_account,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.user_pc_token_account,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
self.user_lp_token_account,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.user_owner,
true,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
self.serum_event_queue,
false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = borsh::to_vec(&DepositInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);
solana_instruction::Instruction {
program_id: crate::RAYDIUM_AMM_ID,
accounts,
data,
}
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DepositInstructionData {
discriminator: [u8; 8],
}
impl DepositInstructionData {
pub fn new() -> Self {
Self {
discriminator: [242, 35, 198, 137, 82, 225, 242, 182],
}
}
}
impl Default for DepositInstructionData {
fn default() -> Self {
Self::new()
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DepositInstructionArgs {
pub max_coin_amount: u64,
pub max_pc_amount: u64,
pub base_side: u64,
}
#[derive(Clone, Debug, Default)]
pub struct DepositBuilder {
token_program: Option<solana_pubkey::Pubkey>,
amm: Option<solana_pubkey::Pubkey>,
amm_authority: Option<solana_pubkey::Pubkey>,
amm_open_orders: Option<solana_pubkey::Pubkey>,
amm_target_orders: Option<solana_pubkey::Pubkey>,
lp_mint_address: Option<solana_pubkey::Pubkey>,
pool_coin_token_account: Option<solana_pubkey::Pubkey>,
pool_pc_token_account: Option<solana_pubkey::Pubkey>,
serum_market: Option<solana_pubkey::Pubkey>,
user_coin_token_account: Option<solana_pubkey::Pubkey>,
user_pc_token_account: Option<solana_pubkey::Pubkey>,
user_lp_token_account: Option<solana_pubkey::Pubkey>,
user_owner: Option<solana_pubkey::Pubkey>,
serum_event_queue: Option<solana_pubkey::Pubkey>,
max_coin_amount: Option<u64>,
max_pc_amount: Option<u64>,
base_side: Option<u64>,
__remaining_accounts: Vec<solana_instruction::AccountMeta>,
}
impl DepositBuilder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self {
self.token_program = Some(token_program);
self
}
#[inline(always)]
pub fn amm(&mut self, amm: solana_pubkey::Pubkey) -> &mut Self {
self.amm = Some(amm);
self
}
#[inline(always)]
pub fn amm_authority(&mut self, amm_authority: solana_pubkey::Pubkey) -> &mut Self {
self.amm_authority = Some(amm_authority);
self
}
#[inline(always)]
pub fn amm_open_orders(&mut self, amm_open_orders: solana_pubkey::Pubkey) -> &mut Self {
self.amm_open_orders = Some(amm_open_orders);
self
}
#[inline(always)]
pub fn amm_target_orders(&mut self, amm_target_orders: solana_pubkey::Pubkey) -> &mut Self {
self.amm_target_orders = Some(amm_target_orders);
self
}
#[inline(always)]
pub fn lp_mint_address(&mut self, lp_mint_address: solana_pubkey::Pubkey) -> &mut Self {
self.lp_mint_address = Some(lp_mint_address);
self
}
#[inline(always)]
pub fn pool_coin_token_account(
&mut self,
pool_coin_token_account: solana_pubkey::Pubkey,
) -> &mut Self {
self.pool_coin_token_account = Some(pool_coin_token_account);
self
}
#[inline(always)]
pub fn pool_pc_token_account(
&mut self,
pool_pc_token_account: solana_pubkey::Pubkey,
) -> &mut Self {
self.pool_pc_token_account = Some(pool_pc_token_account);
self
}
#[inline(always)]
pub fn serum_market(&mut self, serum_market: solana_pubkey::Pubkey) -> &mut Self {
self.serum_market = Some(serum_market);
self
}
#[inline(always)]
pub fn user_coin_token_account(
&mut self,
user_coin_token_account: solana_pubkey::Pubkey,
) -> &mut Self {
self.user_coin_token_account = Some(user_coin_token_account);
self
}
#[inline(always)]
pub fn user_pc_token_account(
&mut self,
user_pc_token_account: solana_pubkey::Pubkey,
) -> &mut Self {
self.user_pc_token_account = Some(user_pc_token_account);
self
}
#[inline(always)]
pub fn user_lp_token_account(
&mut self,
user_lp_token_account: solana_pubkey::Pubkey,
) -> &mut Self {
self.user_lp_token_account = Some(user_lp_token_account);
self
}
#[inline(always)]
pub fn user_owner(&mut self, user_owner: solana_pubkey::Pubkey) -> &mut Self {
self.user_owner = Some(user_owner);
self
}
#[inline(always)]
pub fn serum_event_queue(&mut self, serum_event_queue: solana_pubkey::Pubkey) -> &mut Self {
self.serum_event_queue = Some(serum_event_queue);
self
}
#[inline(always)]
pub fn max_coin_amount(&mut self, max_coin_amount: u64) -> &mut Self {
self.max_coin_amount = Some(max_coin_amount);
self
}
#[inline(always)]
pub fn max_pc_amount(&mut self, max_pc_amount: u64) -> &mut Self {
self.max_pc_amount = Some(max_pc_amount);
self
}
#[inline(always)]
pub fn base_side(&mut self, base_side: u64) -> &mut Self {
self.base_side = Some(base_side);
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 = Deposit {
token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!(
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
)),
amm: self.amm.expect("amm is not set"),
amm_authority: self.amm_authority.expect("amm_authority is not set"),
amm_open_orders: self.amm_open_orders.expect("amm_open_orders is not set"),
amm_target_orders: self
.amm_target_orders
.expect("amm_target_orders is not set"),
lp_mint_address: self.lp_mint_address.expect("lp_mint_address is not set"),
pool_coin_token_account: self
.pool_coin_token_account
.expect("pool_coin_token_account is not set"),
pool_pc_token_account: self
.pool_pc_token_account
.expect("pool_pc_token_account is not set"),
serum_market: self.serum_market.expect("serum_market is not set"),
user_coin_token_account: self
.user_coin_token_account
.expect("user_coin_token_account is not set"),
user_pc_token_account: self
.user_pc_token_account
.expect("user_pc_token_account is not set"),
user_lp_token_account: self
.user_lp_token_account
.expect("user_lp_token_account is not set"),
user_owner: self.user_owner.expect("user_owner is not set"),
serum_event_queue: self
.serum_event_queue
.expect("serum_event_queue is not set"),
};
let args = DepositInstructionArgs {
max_coin_amount: self
.max_coin_amount
.clone()
.expect("max_coin_amount is not set"),
max_pc_amount: self
.max_pc_amount
.clone()
.expect("max_pc_amount is not set"),
base_side: self.base_side.clone().expect("base_side is not set"),
};
accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
}
}
pub struct DepositCpiAccounts<'a, 'b> {
pub token_program: &'b solana_account_info::AccountInfo<'a>,
pub amm: &'b solana_account_info::AccountInfo<'a>,
pub amm_authority: &'b solana_account_info::AccountInfo<'a>,
pub amm_open_orders: &'b solana_account_info::AccountInfo<'a>,
pub amm_target_orders: &'b solana_account_info::AccountInfo<'a>,
pub lp_mint_address: &'b solana_account_info::AccountInfo<'a>,
pub pool_coin_token_account: &'b solana_account_info::AccountInfo<'a>,
pub pool_pc_token_account: &'b solana_account_info::AccountInfo<'a>,
pub serum_market: &'b solana_account_info::AccountInfo<'a>,
pub user_coin_token_account: &'b solana_account_info::AccountInfo<'a>,
pub user_pc_token_account: &'b solana_account_info::AccountInfo<'a>,
pub user_lp_token_account: &'b solana_account_info::AccountInfo<'a>,
pub user_owner: &'b solana_account_info::AccountInfo<'a>,
pub serum_event_queue: &'b solana_account_info::AccountInfo<'a>,
}
pub struct DepositCpi<'a, 'b> {
pub __program: &'b solana_account_info::AccountInfo<'a>,
pub token_program: &'b solana_account_info::AccountInfo<'a>,
pub amm: &'b solana_account_info::AccountInfo<'a>,
pub amm_authority: &'b solana_account_info::AccountInfo<'a>,
pub amm_open_orders: &'b solana_account_info::AccountInfo<'a>,
pub amm_target_orders: &'b solana_account_info::AccountInfo<'a>,
pub lp_mint_address: &'b solana_account_info::AccountInfo<'a>,
pub pool_coin_token_account: &'b solana_account_info::AccountInfo<'a>,
pub pool_pc_token_account: &'b solana_account_info::AccountInfo<'a>,
pub serum_market: &'b solana_account_info::AccountInfo<'a>,
pub user_coin_token_account: &'b solana_account_info::AccountInfo<'a>,
pub user_pc_token_account: &'b solana_account_info::AccountInfo<'a>,
pub user_lp_token_account: &'b solana_account_info::AccountInfo<'a>,
pub user_owner: &'b solana_account_info::AccountInfo<'a>,
pub serum_event_queue: &'b solana_account_info::AccountInfo<'a>,
pub __args: DepositInstructionArgs,
}
impl<'a, 'b> DepositCpi<'a, 'b> {
pub fn new(
program: &'b solana_account_info::AccountInfo<'a>,
accounts: DepositCpiAccounts<'a, 'b>,
args: DepositInstructionArgs,
) -> Self {
Self {
__program: program,
token_program: accounts.token_program,
amm: accounts.amm,
amm_authority: accounts.amm_authority,
amm_open_orders: accounts.amm_open_orders,
amm_target_orders: accounts.amm_target_orders,
lp_mint_address: accounts.lp_mint_address,
pool_coin_token_account: accounts.pool_coin_token_account,
pool_pc_token_account: accounts.pool_pc_token_account,
serum_market: accounts.serum_market,
user_coin_token_account: accounts.user_coin_token_account,
user_pc_token_account: accounts.user_pc_token_account,
user_lp_token_account: accounts.user_lp_token_account,
user_owner: accounts.user_owner,
serum_event_queue: accounts.serum_event_queue,
__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(14 + remaining_accounts.len());
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.token_program.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(*self.amm.key, false));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.amm_authority.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.amm_open_orders.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.amm_target_orders.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.lp_mint_address.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.pool_coin_token_account.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.pool_pc_token_account.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.serum_market.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.user_coin_token_account.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.user_pc_token_account.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new(
*self.user_lp_token_account.key,
false,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.user_owner.key,
true,
));
accounts.push(solana_instruction::AccountMeta::new_readonly(
*self.serum_event_queue.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(&DepositInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);
let instruction = solana_instruction::Instruction {
program_id: crate::RAYDIUM_AMM_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(15 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.token_program.clone());
account_infos.push(self.amm.clone());
account_infos.push(self.amm_authority.clone());
account_infos.push(self.amm_open_orders.clone());
account_infos.push(self.amm_target_orders.clone());
account_infos.push(self.lp_mint_address.clone());
account_infos.push(self.pool_coin_token_account.clone());
account_infos.push(self.pool_pc_token_account.clone());
account_infos.push(self.serum_market.clone());
account_infos.push(self.user_coin_token_account.clone());
account_infos.push(self.user_pc_token_account.clone());
account_infos.push(self.user_lp_token_account.clone());
account_infos.push(self.user_owner.clone());
account_infos.push(self.serum_event_queue.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 DepositCpiBuilder<'a, 'b> {
instruction: Box<DepositCpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> DepositCpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(DepositCpiBuilderInstruction {
__program: program,
token_program: None,
amm: None,
amm_authority: None,
amm_open_orders: None,
amm_target_orders: None,
lp_mint_address: None,
pool_coin_token_account: None,
pool_pc_token_account: None,
serum_market: None,
user_coin_token_account: None,
user_pc_token_account: None,
user_lp_token_account: None,
user_owner: None,
serum_event_queue: None,
max_coin_amount: None,
max_pc_amount: None,
base_side: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[inline(always)]
pub fn token_program(
&mut self,
token_program: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.token_program = Some(token_program);
self
}
#[inline(always)]
pub fn amm(&mut self, amm: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.amm = Some(amm);
self
}
#[inline(always)]
pub fn amm_authority(
&mut self,
amm_authority: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.amm_authority = Some(amm_authority);
self
}
#[inline(always)]
pub fn amm_open_orders(
&mut self,
amm_open_orders: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.amm_open_orders = Some(amm_open_orders);
self
}
#[inline(always)]
pub fn amm_target_orders(
&mut self,
amm_target_orders: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.amm_target_orders = Some(amm_target_orders);
self
}
#[inline(always)]
pub fn lp_mint_address(
&mut self,
lp_mint_address: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.lp_mint_address = Some(lp_mint_address);
self
}
#[inline(always)]
pub fn pool_coin_token_account(
&mut self,
pool_coin_token_account: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.pool_coin_token_account = Some(pool_coin_token_account);
self
}
#[inline(always)]
pub fn pool_pc_token_account(
&mut self,
pool_pc_token_account: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.pool_pc_token_account = Some(pool_pc_token_account);
self
}
#[inline(always)]
pub fn serum_market(
&mut self,
serum_market: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.serum_market = Some(serum_market);
self
}
#[inline(always)]
pub fn user_coin_token_account(
&mut self,
user_coin_token_account: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.user_coin_token_account = Some(user_coin_token_account);
self
}
#[inline(always)]
pub fn user_pc_token_account(
&mut self,
user_pc_token_account: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.user_pc_token_account = Some(user_pc_token_account);
self
}
#[inline(always)]
pub fn user_lp_token_account(
&mut self,
user_lp_token_account: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.user_lp_token_account = Some(user_lp_token_account);
self
}
#[inline(always)]
pub fn user_owner(
&mut self,
user_owner: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.user_owner = Some(user_owner);
self
}
#[inline(always)]
pub fn serum_event_queue(
&mut self,
serum_event_queue: &'b solana_account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.serum_event_queue = Some(serum_event_queue);
self
}
#[inline(always)]
pub fn max_coin_amount(&mut self, max_coin_amount: u64) -> &mut Self {
self.instruction.max_coin_amount = Some(max_coin_amount);
self
}
#[inline(always)]
pub fn max_pc_amount(&mut self, max_pc_amount: u64) -> &mut Self {
self.instruction.max_pc_amount = Some(max_pc_amount);
self
}
#[inline(always)]
pub fn base_side(&mut self, base_side: u64) -> &mut Self {
self.instruction.base_side = Some(base_side);
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 = DepositInstructionArgs {
max_coin_amount: self
.instruction
.max_coin_amount
.clone()
.expect("max_coin_amount is not set"),
max_pc_amount: self
.instruction
.max_pc_amount
.clone()
.expect("max_pc_amount is not set"),
base_side: self
.instruction
.base_side
.clone()
.expect("base_side is not set"),
};
let instruction = DepositCpi {
__program: self.instruction.__program,
token_program: self
.instruction
.token_program
.expect("token_program is not set"),
amm: self.instruction.amm.expect("amm is not set"),
amm_authority: self
.instruction
.amm_authority
.expect("amm_authority is not set"),
amm_open_orders: self
.instruction
.amm_open_orders
.expect("amm_open_orders is not set"),
amm_target_orders: self
.instruction
.amm_target_orders
.expect("amm_target_orders is not set"),
lp_mint_address: self
.instruction
.lp_mint_address
.expect("lp_mint_address is not set"),
pool_coin_token_account: self
.instruction
.pool_coin_token_account
.expect("pool_coin_token_account is not set"),
pool_pc_token_account: self
.instruction
.pool_pc_token_account
.expect("pool_pc_token_account is not set"),
serum_market: self
.instruction
.serum_market
.expect("serum_market is not set"),
user_coin_token_account: self
.instruction
.user_coin_token_account
.expect("user_coin_token_account is not set"),
user_pc_token_account: self
.instruction
.user_pc_token_account
.expect("user_pc_token_account is not set"),
user_lp_token_account: self
.instruction
.user_lp_token_account
.expect("user_lp_token_account is not set"),
user_owner: self.instruction.user_owner.expect("user_owner is not set"),
serum_event_queue: self
.instruction
.serum_event_queue
.expect("serum_event_queue is not set"),
__args: args,
};
instruction.invoke_signed_with_remaining_accounts(
signers_seeds,
&self.instruction.__remaining_accounts,
)
}
}
#[derive(Clone, Debug)]
struct DepositCpiBuilderInstruction<'a, 'b> {
__program: &'b solana_account_info::AccountInfo<'a>,
token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
amm: Option<&'b solana_account_info::AccountInfo<'a>>,
amm_authority: Option<&'b solana_account_info::AccountInfo<'a>>,
amm_open_orders: Option<&'b solana_account_info::AccountInfo<'a>>,
amm_target_orders: Option<&'b solana_account_info::AccountInfo<'a>>,
lp_mint_address: Option<&'b solana_account_info::AccountInfo<'a>>,
pool_coin_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
pool_pc_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
serum_market: Option<&'b solana_account_info::AccountInfo<'a>>,
user_coin_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
user_pc_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
user_lp_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
user_owner: Option<&'b solana_account_info::AccountInfo<'a>>,
serum_event_queue: Option<&'b solana_account_info::AccountInfo<'a>>,
max_coin_amount: Option<u64>,
max_pc_amount: Option<u64>,
base_side: Option<u64>,
__remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
}