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 GlobalConfig {
    /// Account update epoch
    pub epoch: u64,
    /// 0: Constant Product Curve
    /// 1: Fixed Price Curve
    /// 2: Linear Price Curve
    pub curve_type: u8,
    /// Config index
    pub index: u16,
    /// The fee of migrate to amm
    pub migrate_fee: u64,
    /// The trade fee rate, denominated in hundredths of a bip (10^-6)
    pub trade_fee_rate: u64,
    /// The maximum share fee rate, denominated in hundredths of a bip (10^-6)
    pub max_share_fee_rate: u64,
    /// The minimum base supply, the value without decimals
    pub min_base_supply: u64,
    /// The maximum lock rate, denominated in hundredths of a bip (10^-6)
    pub max_lock_rate: u64,
    /// The minimum base sell rate, denominated in hundredths of a bip (10^-6)
    pub min_base_sell_rate: u64,
    /// The minimum base migrate rate, denominated in hundredths of a bip
    /// (10^-6)
    pub min_base_migrate_rate: u64,
    /// The minimum quote fund raising, the value with decimals
    pub min_quote_fund_raising: u64,
    /// Mint information for quote token
    pub quote_mint: Pubkey,
    /// Protocol Fee owner
    pub protocol_fee_owner: Pubkey,
    /// Migrate Fee owner
    pub migrate_fee_owner: Pubkey,
    /// Migrate to amm control wallet
    pub migrate_to_amm_wallet: Pubkey,
    /// Migrate to cpswap wallet
    pub migrate_to_cpswap_wallet: Pubkey,
    /// Whether a platform must be explicitly authorized before using this
    /// global config
    pub requires_platform_auth: u8,
    /// padding alignment
    pub padding_alignment: [u8; 7],
    /// padding for future updates
    pub padding: [u64; 15],
}

impl GlobalConfig {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [149, 8, 156, 202, 160, 252, 176, 217] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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