carbon-raydium-launchpad-decoder 2.0.0

Raydium Launchpad 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 VestingRecord {
    /// Account update epoch
    pub epoch: u64,
    /// The pool state account
    pub pool: Pubkey,
    /// The beneficiary of the vesting account
    pub beneficiary: Pubkey,
    /// The amount of tokens claimed
    pub claimed_amount: u64,
    /// The share amount of the token to be vested
    pub token_share_amount: u64,
    /// padding for future updates
    pub padding: [u64; 8],
}

impl VestingRecord {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [106, 243, 221, 205, 230, 126, 85, 83] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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