carbon-virtuals-decoder 1.0.0

Virtuals Program Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct BuyEventEvent {
    pub buy_amount: u64,
    pub virtuals_amount: u64,
}

impl BuyEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [103, 244, 82, 31, 44, 245, 119, 119] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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