carbon-pump-fees-decoder 2.0.0

PumpFees 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 SocialFeePda {
    pub bump: u8,
    pub version: u8,
    /// Max 20 characters to fit u64::MAX (18,446,744,073,709,551,615) as a
    /// string. Actual storage: 4 bytes (length prefix) + 20 bytes (content)
    /// = 24 bytes.
    pub user_id: String,
    pub platform: u8,
    pub total_claimed: u64,
    pub last_claimed: u64,
    #[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
    pub reserved: [u8; 128],
}

impl SocialFeePda {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [139, 96, 53, 17, 42, 169, 206, 150] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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