1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! 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()
}
}