carbon-raydium-launchpad-decoder 2.0.0

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

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct PlatformConfig {
    /// The epoch for update interval
    pub epoch: u64,
    /// The platform fee wallet
    pub platform_fee_wallet: Pubkey,
    /// The platform nft wallet to receive the platform NFT after migration if
    /// platform_scale is not 0(Only support MigrateType::CPSWAP)
    pub platform_nft_wallet: Pubkey,
    /// Scale of the platform liquidity quantity rights will be converted into
    /// NFT(Only support MigrateType::CPSWAP)
    pub platform_scale: u64,
    /// Scale of the token creator liquidity quantity rights will be converted
    /// into NFT(Only support MigrateType::CPSWAP)
    pub creator_scale: u64,
    /// Scale of liquidity directly to burn
    pub burn_scale: u64,
    /// The platform fee rate
    pub fee_rate: u64,
    /// The platform name
    #[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
    pub name: [u8; 64],
    /// The platform website
    #[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
    pub web: [u8; 256],
    /// The platform img link
    #[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
    pub img: [u8; 256],
    /// The platform specifies the trade fee rate after migration to cp swap
    pub cpswap_config: Pubkey,
    /// Creator fee rate
    pub creator_fee_rate: u64,
    /// If the base token belongs to token2022, then you can choose to support
    /// the transferfeeConfig extension, which includes permissions such as
    /// `transfer_fee_config_authority`` and `withdraw_withheld_authority`.
    /// When initializing mint, `withdraw_withheld_authority` and
    /// `transfer_fee_config_authority` both belongs to the contract.
    /// Once the token is migrated to AMM, the authorities will be reset to this
    /// value
    pub transfer_fee_extension_auth: Pubkey,
    pub platform_vesting_wallet: Pubkey,
    pub platform_vesting_scale: u64,
    /// If a valid platform_cp_creator is configured for the platform,
    /// it will be used as the creator for the AMM pool during migration to
    /// cpswap pool.
    pub platform_cp_creator: Pubkey,
    /// padding for future updates
    #[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
    pub padding: [u8; 108],
    /// The parameters for launching the pool
    pub curve_params: Vec<PlatformCurveParam>,
}

impl PlatformConfig {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [160, 78, 128, 0, 248, 83, 230, 160] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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