carbon-moonshot-decoder 1.0.0

Moonshot 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 MigrationEventEvent {
    pub tokens_migrated: u64,
    pub tokens_burned: u64,
    pub collateral_migrated: u64,
    pub fee: u64,
    pub label: String,
}

impl MigrationEventEvent {
    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, 255, 202, 76, 147, 91, 231, 73, 22,
            ]
        {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[16..];

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