carbon-jupiter-lend-decoder 2.0.0

Jupiter Lend Liquidity Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use solana_pubkey::Pubkey;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct LogOperateEvent {
    pub user: Pubkey,
    pub token: Pubkey,
    pub supply_amount: i128,
    pub borrow_amount: i128,
    pub withdraw_to: Pubkey,
    pub borrow_to: Pubkey,
    pub supply_exchange_price: u64,
    pub borrow_exchange_price: u64,
}

impl LogOperateEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [180, 8, 81, 71, 19, 132, 173, 8] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
    }
}