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 LogUpdateExchangePricesEvent {
    pub token: Pubkey,
    pub supply_exchange_price: u128,
    pub borrow_exchange_price: u128,
    pub borrow_rate: u16,
    pub utilization: u16,
}

impl LogUpdateExchangePricesEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [190, 194, 69, 204, 30, 86, 181, 163] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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