carbon-meteora-dbc-decoder 1.0.0

Meteora DBC Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {crate::types::PoolFees, solana_pubkey::Pubkey};

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct Config {
    pub pool_fees: PoolFees,
    pub activation_duration: u64,
    pub vault_config_key: Pubkey,
    pub pool_creator_authority: Pubkey,
    pub activation_type: u8,
    pub partner_fee_numerator: u64,
    #[cfg_attr(feature = "serde", serde(with = "serde_big_array::BigArray"))]
    pub padding: [u8; 219],
}

impl Config {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [155, 12, 170, 224, 30, 250, 204, 130] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

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