carbon-raydium-launchpad-decoder 2.0.0

Raydium Launchpad Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    crate::types::{AmmCreatorFeeOn, CurveParams, MintParams, VestingParams},
    solana_pubkey::Pubkey,
};

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct PoolCreateEventEvent {
    pub pool_state: Pubkey,
    pub creator: Pubkey,
    pub config: Pubkey,
    pub base_mint_param: MintParams,
    pub curve_param: CurveParams,
    pub vesting_param: VestingParams,
    pub amm_fee_on: AmmCreatorFeeOn,
}

impl PoolCreateEventEvent {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [151, 215, 226, 9, 118, 161, 115, 174] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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