carbon-openbook-v2-decoder 2.0.0

Openbook V2 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 TotalOrderFillEventEvent {
    pub side: u8,
    pub taker: Pubkey,
    pub total_quantity_paid: u64,
    pub total_quantity_received: u64,
    pub fees: u64,
}

impl TotalOrderFillEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 16 {
            return None;
        }
        let discriminator = &data[0..16];
        if discriminator
            != [
                228, 69, 165, 46, 81, 203, 154, 29, 8, 235, 48, 58, 174, 76, 156, 105,
            ]
        {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[16..];

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