use crate::types::BorrowLendParams;
use crate::types::JumpRateState;
use crate::types::PricingParams;
use borsh::{BorshDeserialize, BorshSerialize};
pub const OPERATOR_SET_CUSTODY_CONFIG_DISCRIMINATOR: [u8; 8] =
[166, 137, 92, 204, 145, 224, 24, 218];
#[derive(Debug)]
pub struct OperatorSetCustodyConfig {
pub operator: solana_program::pubkey::Pubkey,
pub custody: solana_program::pubkey::Pubkey,
}
impl OperatorSetCustodyConfig {
pub fn instruction(
&self,
args: OperatorSetCustodyConfigInstructionArgs,
) -> 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: OperatorSetCustodyConfigInstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(2 + remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.operator,
true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.custody,
false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = borsh::to_vec(&OperatorSetCustodyConfigInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);
solana_program::instruction::Instruction {
program_id: crate::PERPETUALS_ID,
accounts,
data,
}
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct OperatorSetCustodyConfigInstructionData {
discriminator: [u8; 8],
}
impl OperatorSetCustodyConfigInstructionData {
pub fn new() -> Self {
Self {
discriminator: [166, 137, 92, 204, 145, 224, 24, 218],
}
}
}
impl Default for OperatorSetCustodyConfigInstructionData {
fn default() -> Self {
Self::new()
}
}
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct OperatorSetCustodyConfigInstructionArgs {
pub pricing: PricingParams,
pub hourly_funding_dbps: u64,
pub target_ratio_bps: u64,
pub increase_position_bps: u64,
pub decrease_position_bps: u64,
pub max_position_size_usd: u64,
pub jump_rate: JumpRateState,
pub price_impact_fee_factor: u64,
pub price_impact_exponent: f32,
pub delta_imbalance_threshold_decimal: u64,
pub max_fee_bps: u64,
pub borrow_lend_parameters: BorrowLendParams,
pub borrow_hourly_funding_dbps: u64,
pub borrow_limit_in_token_amount: u64,
pub min_interest_fee_bps: u64,
pub min_interest_fee_grace_period_seconds: u64,
pub max_total_staked_amount_lamports: u64,
pub external_swap_fee_multiplier_bps: u64,
pub disable_close_position_request: bool,
pub withdrawal_limit_token_amount: u64,
pub withdrawal_limit_interval_seconds: u64,
}
#[derive(Clone, Debug, Default)]
pub struct OperatorSetCustodyConfigBuilder {
operator: Option<solana_program::pubkey::Pubkey>,
custody: Option<solana_program::pubkey::Pubkey>,
pricing: Option<PricingParams>,
hourly_funding_dbps: Option<u64>,
target_ratio_bps: Option<u64>,
increase_position_bps: Option<u64>,
decrease_position_bps: Option<u64>,
max_position_size_usd: Option<u64>,
jump_rate: Option<JumpRateState>,
price_impact_fee_factor: Option<u64>,
price_impact_exponent: Option<f32>,
delta_imbalance_threshold_decimal: Option<u64>,
max_fee_bps: Option<u64>,
borrow_lend_parameters: Option<BorrowLendParams>,
borrow_hourly_funding_dbps: Option<u64>,
borrow_limit_in_token_amount: Option<u64>,
min_interest_fee_bps: Option<u64>,
min_interest_fee_grace_period_seconds: Option<u64>,
max_total_staked_amount_lamports: Option<u64>,
external_swap_fee_multiplier_bps: Option<u64>,
disable_close_position_request: Option<bool>,
withdrawal_limit_token_amount: Option<u64>,
withdrawal_limit_interval_seconds: Option<u64>,
__remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
}
impl OperatorSetCustodyConfigBuilder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn operator(&mut self, operator: solana_program::pubkey::Pubkey) -> &mut Self {
self.operator = Some(operator);
self
}
#[inline(always)]
pub fn custody(&mut self, custody: solana_program::pubkey::Pubkey) -> &mut Self {
self.custody = Some(custody);
self
}
#[inline(always)]
pub fn pricing(&mut self, pricing: PricingParams) -> &mut Self {
self.pricing = Some(pricing);
self
}
#[inline(always)]
pub fn hourly_funding_dbps(&mut self, hourly_funding_dbps: u64) -> &mut Self {
self.hourly_funding_dbps = Some(hourly_funding_dbps);
self
}
#[inline(always)]
pub fn target_ratio_bps(&mut self, target_ratio_bps: u64) -> &mut Self {
self.target_ratio_bps = Some(target_ratio_bps);
self
}
#[inline(always)]
pub fn increase_position_bps(&mut self, increase_position_bps: u64) -> &mut Self {
self.increase_position_bps = Some(increase_position_bps);
self
}
#[inline(always)]
pub fn decrease_position_bps(&mut self, decrease_position_bps: u64) -> &mut Self {
self.decrease_position_bps = Some(decrease_position_bps);
self
}
#[inline(always)]
pub fn max_position_size_usd(&mut self, max_position_size_usd: u64) -> &mut Self {
self.max_position_size_usd = Some(max_position_size_usd);
self
}
#[inline(always)]
pub fn jump_rate(&mut self, jump_rate: JumpRateState) -> &mut Self {
self.jump_rate = Some(jump_rate);
self
}
#[inline(always)]
pub fn price_impact_fee_factor(&mut self, price_impact_fee_factor: u64) -> &mut Self {
self.price_impact_fee_factor = Some(price_impact_fee_factor);
self
}
#[inline(always)]
pub fn price_impact_exponent(&mut self, price_impact_exponent: f32) -> &mut Self {
self.price_impact_exponent = Some(price_impact_exponent);
self
}
#[inline(always)]
pub fn delta_imbalance_threshold_decimal(
&mut self,
delta_imbalance_threshold_decimal: u64,
) -> &mut Self {
self.delta_imbalance_threshold_decimal = Some(delta_imbalance_threshold_decimal);
self
}
#[inline(always)]
pub fn max_fee_bps(&mut self, max_fee_bps: u64) -> &mut Self {
self.max_fee_bps = Some(max_fee_bps);
self
}
#[inline(always)]
pub fn borrow_lend_parameters(
&mut self,
borrow_lend_parameters: BorrowLendParams,
) -> &mut Self {
self.borrow_lend_parameters = Some(borrow_lend_parameters);
self
}
#[inline(always)]
pub fn borrow_hourly_funding_dbps(&mut self, borrow_hourly_funding_dbps: u64) -> &mut Self {
self.borrow_hourly_funding_dbps = Some(borrow_hourly_funding_dbps);
self
}
#[inline(always)]
pub fn borrow_limit_in_token_amount(&mut self, borrow_limit_in_token_amount: u64) -> &mut Self {
self.borrow_limit_in_token_amount = Some(borrow_limit_in_token_amount);
self
}
#[inline(always)]
pub fn min_interest_fee_bps(&mut self, min_interest_fee_bps: u64) -> &mut Self {
self.min_interest_fee_bps = Some(min_interest_fee_bps);
self
}
#[inline(always)]
pub fn min_interest_fee_grace_period_seconds(
&mut self,
min_interest_fee_grace_period_seconds: u64,
) -> &mut Self {
self.min_interest_fee_grace_period_seconds = Some(min_interest_fee_grace_period_seconds);
self
}
#[inline(always)]
pub fn max_total_staked_amount_lamports(
&mut self,
max_total_staked_amount_lamports: u64,
) -> &mut Self {
self.max_total_staked_amount_lamports = Some(max_total_staked_amount_lamports);
self
}
#[inline(always)]
pub fn external_swap_fee_multiplier_bps(
&mut self,
external_swap_fee_multiplier_bps: u64,
) -> &mut Self {
self.external_swap_fee_multiplier_bps = Some(external_swap_fee_multiplier_bps);
self
}
#[inline(always)]
pub fn disable_close_position_request(
&mut self,
disable_close_position_request: bool,
) -> &mut Self {
self.disable_close_position_request = Some(disable_close_position_request);
self
}
#[inline(always)]
pub fn withdrawal_limit_token_amount(
&mut self,
withdrawal_limit_token_amount: u64,
) -> &mut Self {
self.withdrawal_limit_token_amount = Some(withdrawal_limit_token_amount);
self
}
#[inline(always)]
pub fn withdrawal_limit_interval_seconds(
&mut self,
withdrawal_limit_interval_seconds: u64,
) -> &mut Self {
self.withdrawal_limit_interval_seconds = Some(withdrawal_limit_interval_seconds);
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 = OperatorSetCustodyConfig {
operator: self.operator.expect("operator is not set"),
custody: self.custody.expect("custody is not set"),
};
let args = OperatorSetCustodyConfigInstructionArgs {
pricing: self.pricing.clone().expect("pricing is not set"),
hourly_funding_dbps: self
.hourly_funding_dbps
.clone()
.expect("hourly_funding_dbps is not set"),
target_ratio_bps: self
.target_ratio_bps
.clone()
.expect("target_ratio_bps is not set"),
increase_position_bps: self
.increase_position_bps
.clone()
.expect("increase_position_bps is not set"),
decrease_position_bps: self
.decrease_position_bps
.clone()
.expect("decrease_position_bps is not set"),
max_position_size_usd: self
.max_position_size_usd
.clone()
.expect("max_position_size_usd is not set"),
jump_rate: self.jump_rate.clone().expect("jump_rate is not set"),
price_impact_fee_factor: self
.price_impact_fee_factor
.clone()
.expect("price_impact_fee_factor is not set"),
price_impact_exponent: self
.price_impact_exponent
.clone()
.expect("price_impact_exponent is not set"),
delta_imbalance_threshold_decimal: self
.delta_imbalance_threshold_decimal
.clone()
.expect("delta_imbalance_threshold_decimal is not set"),
max_fee_bps: self.max_fee_bps.clone().expect("max_fee_bps is not set"),
borrow_lend_parameters: self
.borrow_lend_parameters
.clone()
.expect("borrow_lend_parameters is not set"),
borrow_hourly_funding_dbps: self
.borrow_hourly_funding_dbps
.clone()
.expect("borrow_hourly_funding_dbps is not set"),
borrow_limit_in_token_amount: self
.borrow_limit_in_token_amount
.clone()
.expect("borrow_limit_in_token_amount is not set"),
min_interest_fee_bps: self
.min_interest_fee_bps
.clone()
.expect("min_interest_fee_bps is not set"),
min_interest_fee_grace_period_seconds: self
.min_interest_fee_grace_period_seconds
.clone()
.expect("min_interest_fee_grace_period_seconds is not set"),
max_total_staked_amount_lamports: self
.max_total_staked_amount_lamports
.clone()
.expect("max_total_staked_amount_lamports is not set"),
external_swap_fee_multiplier_bps: self
.external_swap_fee_multiplier_bps
.clone()
.expect("external_swap_fee_multiplier_bps is not set"),
disable_close_position_request: self
.disable_close_position_request
.clone()
.expect("disable_close_position_request is not set"),
withdrawal_limit_token_amount: self
.withdrawal_limit_token_amount
.clone()
.expect("withdrawal_limit_token_amount is not set"),
withdrawal_limit_interval_seconds: self
.withdrawal_limit_interval_seconds
.clone()
.expect("withdrawal_limit_interval_seconds is not set"),
};
accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
}
}
pub struct OperatorSetCustodyConfigCpiAccounts<'a, 'b> {
pub operator: &'b solana_program::account_info::AccountInfo<'a>,
pub custody: &'b solana_program::account_info::AccountInfo<'a>,
}
pub struct OperatorSetCustodyConfigCpi<'a, 'b> {
pub __program: &'b solana_program::account_info::AccountInfo<'a>,
pub operator: &'b solana_program::account_info::AccountInfo<'a>,
pub custody: &'b solana_program::account_info::AccountInfo<'a>,
pub __args: OperatorSetCustodyConfigInstructionArgs,
}
impl<'a, 'b> OperatorSetCustodyConfigCpi<'a, 'b> {
pub fn new(
program: &'b solana_program::account_info::AccountInfo<'a>,
accounts: OperatorSetCustodyConfigCpiAccounts<'a, 'b>,
args: OperatorSetCustodyConfigInstructionArgs,
) -> Self {
Self {
__program: program,
operator: accounts.operator,
custody: accounts.custody,
__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(2 + remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.operator.key,
true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.custody.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(&OperatorSetCustodyConfigInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);
let instruction = solana_program::instruction::Instruction {
program_id: crate::PERPETUALS_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(3 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.operator.clone());
account_infos.push(self.custody.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 OperatorSetCustodyConfigCpiBuilder<'a, 'b> {
instruction: Box<OperatorSetCustodyConfigCpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> OperatorSetCustodyConfigCpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(OperatorSetCustodyConfigCpiBuilderInstruction {
__program: program,
operator: None,
custody: None,
pricing: None,
hourly_funding_dbps: None,
target_ratio_bps: None,
increase_position_bps: None,
decrease_position_bps: None,
max_position_size_usd: None,
jump_rate: None,
price_impact_fee_factor: None,
price_impact_exponent: None,
delta_imbalance_threshold_decimal: None,
max_fee_bps: None,
borrow_lend_parameters: None,
borrow_hourly_funding_dbps: None,
borrow_limit_in_token_amount: None,
min_interest_fee_bps: None,
min_interest_fee_grace_period_seconds: None,
max_total_staked_amount_lamports: None,
external_swap_fee_multiplier_bps: None,
disable_close_position_request: None,
withdrawal_limit_token_amount: None,
withdrawal_limit_interval_seconds: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[inline(always)]
pub fn operator(
&mut self,
operator: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.operator = Some(operator);
self
}
#[inline(always)]
pub fn custody(
&mut self,
custody: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.custody = Some(custody);
self
}
#[inline(always)]
pub fn pricing(&mut self, pricing: PricingParams) -> &mut Self {
self.instruction.pricing = Some(pricing);
self
}
#[inline(always)]
pub fn hourly_funding_dbps(&mut self, hourly_funding_dbps: u64) -> &mut Self {
self.instruction.hourly_funding_dbps = Some(hourly_funding_dbps);
self
}
#[inline(always)]
pub fn target_ratio_bps(&mut self, target_ratio_bps: u64) -> &mut Self {
self.instruction.target_ratio_bps = Some(target_ratio_bps);
self
}
#[inline(always)]
pub fn increase_position_bps(&mut self, increase_position_bps: u64) -> &mut Self {
self.instruction.increase_position_bps = Some(increase_position_bps);
self
}
#[inline(always)]
pub fn decrease_position_bps(&mut self, decrease_position_bps: u64) -> &mut Self {
self.instruction.decrease_position_bps = Some(decrease_position_bps);
self
}
#[inline(always)]
pub fn max_position_size_usd(&mut self, max_position_size_usd: u64) -> &mut Self {
self.instruction.max_position_size_usd = Some(max_position_size_usd);
self
}
#[inline(always)]
pub fn jump_rate(&mut self, jump_rate: JumpRateState) -> &mut Self {
self.instruction.jump_rate = Some(jump_rate);
self
}
#[inline(always)]
pub fn price_impact_fee_factor(&mut self, price_impact_fee_factor: u64) -> &mut Self {
self.instruction.price_impact_fee_factor = Some(price_impact_fee_factor);
self
}
#[inline(always)]
pub fn price_impact_exponent(&mut self, price_impact_exponent: f32) -> &mut Self {
self.instruction.price_impact_exponent = Some(price_impact_exponent);
self
}
#[inline(always)]
pub fn delta_imbalance_threshold_decimal(
&mut self,
delta_imbalance_threshold_decimal: u64,
) -> &mut Self {
self.instruction.delta_imbalance_threshold_decimal =
Some(delta_imbalance_threshold_decimal);
self
}
#[inline(always)]
pub fn max_fee_bps(&mut self, max_fee_bps: u64) -> &mut Self {
self.instruction.max_fee_bps = Some(max_fee_bps);
self
}
#[inline(always)]
pub fn borrow_lend_parameters(
&mut self,
borrow_lend_parameters: BorrowLendParams,
) -> &mut Self {
self.instruction.borrow_lend_parameters = Some(borrow_lend_parameters);
self
}
#[inline(always)]
pub fn borrow_hourly_funding_dbps(&mut self, borrow_hourly_funding_dbps: u64) -> &mut Self {
self.instruction.borrow_hourly_funding_dbps = Some(borrow_hourly_funding_dbps);
self
}
#[inline(always)]
pub fn borrow_limit_in_token_amount(&mut self, borrow_limit_in_token_amount: u64) -> &mut Self {
self.instruction.borrow_limit_in_token_amount = Some(borrow_limit_in_token_amount);
self
}
#[inline(always)]
pub fn min_interest_fee_bps(&mut self, min_interest_fee_bps: u64) -> &mut Self {
self.instruction.min_interest_fee_bps = Some(min_interest_fee_bps);
self
}
#[inline(always)]
pub fn min_interest_fee_grace_period_seconds(
&mut self,
min_interest_fee_grace_period_seconds: u64,
) -> &mut Self {
self.instruction.min_interest_fee_grace_period_seconds =
Some(min_interest_fee_grace_period_seconds);
self
}
#[inline(always)]
pub fn max_total_staked_amount_lamports(
&mut self,
max_total_staked_amount_lamports: u64,
) -> &mut Self {
self.instruction.max_total_staked_amount_lamports = Some(max_total_staked_amount_lamports);
self
}
#[inline(always)]
pub fn external_swap_fee_multiplier_bps(
&mut self,
external_swap_fee_multiplier_bps: u64,
) -> &mut Self {
self.instruction.external_swap_fee_multiplier_bps = Some(external_swap_fee_multiplier_bps);
self
}
#[inline(always)]
pub fn disable_close_position_request(
&mut self,
disable_close_position_request: bool,
) -> &mut Self {
self.instruction.disable_close_position_request = Some(disable_close_position_request);
self
}
#[inline(always)]
pub fn withdrawal_limit_token_amount(
&mut self,
withdrawal_limit_token_amount: u64,
) -> &mut Self {
self.instruction.withdrawal_limit_token_amount = Some(withdrawal_limit_token_amount);
self
}
#[inline(always)]
pub fn withdrawal_limit_interval_seconds(
&mut self,
withdrawal_limit_interval_seconds: u64,
) -> &mut Self {
self.instruction.withdrawal_limit_interval_seconds =
Some(withdrawal_limit_interval_seconds);
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 = OperatorSetCustodyConfigInstructionArgs {
pricing: self
.instruction
.pricing
.clone()
.expect("pricing is not set"),
hourly_funding_dbps: self
.instruction
.hourly_funding_dbps
.clone()
.expect("hourly_funding_dbps is not set"),
target_ratio_bps: self
.instruction
.target_ratio_bps
.clone()
.expect("target_ratio_bps is not set"),
increase_position_bps: self
.instruction
.increase_position_bps
.clone()
.expect("increase_position_bps is not set"),
decrease_position_bps: self
.instruction
.decrease_position_bps
.clone()
.expect("decrease_position_bps is not set"),
max_position_size_usd: self
.instruction
.max_position_size_usd
.clone()
.expect("max_position_size_usd is not set"),
jump_rate: self
.instruction
.jump_rate
.clone()
.expect("jump_rate is not set"),
price_impact_fee_factor: self
.instruction
.price_impact_fee_factor
.clone()
.expect("price_impact_fee_factor is not set"),
price_impact_exponent: self
.instruction
.price_impact_exponent
.clone()
.expect("price_impact_exponent is not set"),
delta_imbalance_threshold_decimal: self
.instruction
.delta_imbalance_threshold_decimal
.clone()
.expect("delta_imbalance_threshold_decimal is not set"),
max_fee_bps: self
.instruction
.max_fee_bps
.clone()
.expect("max_fee_bps is not set"),
borrow_lend_parameters: self
.instruction
.borrow_lend_parameters
.clone()
.expect("borrow_lend_parameters is not set"),
borrow_hourly_funding_dbps: self
.instruction
.borrow_hourly_funding_dbps
.clone()
.expect("borrow_hourly_funding_dbps is not set"),
borrow_limit_in_token_amount: self
.instruction
.borrow_limit_in_token_amount
.clone()
.expect("borrow_limit_in_token_amount is not set"),
min_interest_fee_bps: self
.instruction
.min_interest_fee_bps
.clone()
.expect("min_interest_fee_bps is not set"),
min_interest_fee_grace_period_seconds: self
.instruction
.min_interest_fee_grace_period_seconds
.clone()
.expect("min_interest_fee_grace_period_seconds is not set"),
max_total_staked_amount_lamports: self
.instruction
.max_total_staked_amount_lamports
.clone()
.expect("max_total_staked_amount_lamports is not set"),
external_swap_fee_multiplier_bps: self
.instruction
.external_swap_fee_multiplier_bps
.clone()
.expect("external_swap_fee_multiplier_bps is not set"),
disable_close_position_request: self
.instruction
.disable_close_position_request
.clone()
.expect("disable_close_position_request is not set"),
withdrawal_limit_token_amount: self
.instruction
.withdrawal_limit_token_amount
.clone()
.expect("withdrawal_limit_token_amount is not set"),
withdrawal_limit_interval_seconds: self
.instruction
.withdrawal_limit_interval_seconds
.clone()
.expect("withdrawal_limit_interval_seconds is not set"),
};
let instruction = OperatorSetCustodyConfigCpi {
__program: self.instruction.__program,
operator: self.instruction.operator.expect("operator is not set"),
custody: self.instruction.custody.expect("custody is not set"),
__args: args,
};
instruction.invoke_signed_with_remaining_accounts(
signers_seeds,
&self.instruction.__remaining_accounts,
)
}
}
#[derive(Clone, Debug)]
struct OperatorSetCustodyConfigCpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
operator: Option<&'b solana_program::account_info::AccountInfo<'a>>,
custody: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pricing: Option<PricingParams>,
hourly_funding_dbps: Option<u64>,
target_ratio_bps: Option<u64>,
increase_position_bps: Option<u64>,
decrease_position_bps: Option<u64>,
max_position_size_usd: Option<u64>,
jump_rate: Option<JumpRateState>,
price_impact_fee_factor: Option<u64>,
price_impact_exponent: Option<f32>,
delta_imbalance_threshold_decimal: Option<u64>,
max_fee_bps: Option<u64>,
borrow_lend_parameters: Option<BorrowLendParams>,
borrow_hourly_funding_dbps: Option<u64>,
borrow_limit_in_token_amount: Option<u64>,
min_interest_fee_bps: Option<u64>,
min_interest_fee_grace_period_seconds: Option<u64>,
max_total_staked_amount_lamports: Option<u64>,
external_swap_fee_multiplier_bps: Option<u64>,
disable_close_position_request: Option<bool>,
withdrawal_limit_token_amount: Option<u64>,
withdrawal_limit_interval_seconds: Option<u64>,
__remaining_accounts: Vec<(
&'b solana_program::account_info::AccountInfo<'a>,
bool,
bool,
)>,
}