use solana_pubkey::Pubkey;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct LPPool {
pub pubkey: Pubkey,
pub mint: Pubkey,
pub whitelist_mint: Pubkey,
pub constituent_target_base: Pubkey,
pub constituent_correlations: Pubkey,
pub max_aum: u128,
pub last_aum: u128,
pub cumulative_quote_sent_to_perp_markets: u128,
pub cumulative_quote_received_from_perp_markets: u128,
pub total_mint_redeem_fees_paid: i128,
pub last_aum_slot: u64,
pub max_settle_quote_amount: u64,
pub _padding: u64,
pub mint_redeem_id: u64,
pub settle_id: u64,
pub min_mint_fee: i64,
pub token_supply: u64,
pub volatility: u64,
pub constituents: u16,
pub quote_consituent_index: u16,
pub bump: u8,
pub gamma_execution: u8,
pub xi: u8,
pub target_oracle_delay_fee_bps_per10_slots: u8,
pub target_position_delay_fee_bps_per10_slots: u8,
pub lp_pool_id: u8,
#[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
pub padding: [u8; 174],
}
impl LPPool {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.len() < 8 {
return None;
}
let discriminator = &data[0..8];
if discriminator != [228, 152, 141, 224, 161, 170, 11, 89] {
return None;
}
let mut data_slice = data;
data_slice = &data_slice[8..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}