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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! This code was AUTOGENERATED using the Codama library.
use {
crate::types::{
LiquidityDistributionConfig, LiquidityVestingInfo, LockedVestingConfig, PoolFeesConfig,
},
solana_pubkey::Pubkey,
};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct PoolConfig {
/// quote mint
pub quote_mint: Pubkey,
/// Address to get the fee
pub fee_claimer: Pubkey,
/// Address to receive extra base token after migration, in case token is
/// fixed supply
pub leftover_receiver: Pubkey,
/// Pool fee
pub pool_fees: PoolFeesConfig,
pub partner_liquidity_vesting_info: LiquidityVestingInfo,
pub creator_liquidity_vesting_info: LiquidityVestingInfo,
/// Padding for future use
pub padding0: [u8; 14],
/// Previously was protocol and referral fee percent. Beware of tombstone.
pub padding1: u16,
/// Collect fee mode
pub collect_fee_mode: u8,
/// migration option
pub migration_option: u8,
/// whether mode slot or timestamp
pub activation_type: u8,
/// token decimals
pub token_decimal: u8,
/// version
pub version: u8,
/// token type of base token
pub token_type: u8,
/// quote token flag
pub quote_token_flag: u8,
/// partner locked liquidity percentage
pub partner_permanent_locked_liquidity_percentage: u8,
/// partner liquidity percentage
pub partner_liquidity_percentage: u8,
/// creator post migration fee percentage
pub creator_permanent_locked_liquidity_percentage: u8,
/// creator liquidity percentage
pub creator_liquidity_percentage: u8,
/// migration fee option
pub migration_fee_option: u8,
/// flag to indicate whether token is dynamic supply (0) or fixed supply (1)
pub fixed_token_supply_flag: u8,
/// creator trading fee percentage
pub creator_trading_fee_percentage: u8,
/// token update authority
pub token_update_authority: u8,
/// migration fee percentage
pub migration_fee_percentage: u8,
/// creator migration fee percentage
pub creator_migration_fee_percentage: u8,
pub padding2: [u8; 7],
/// swap base amount
pub swap_base_amount: u64,
/// migration quote threshold (in quote token)
pub migration_quote_threshold: u64,
/// migration base threshold (in base token)
pub migration_base_threshold: u64,
/// migration sqrt price
pub migration_sqrt_price: u128,
/// locked vesting config
pub locked_vesting_config: LockedVestingConfig,
/// pre migration token supply
pub pre_migration_token_supply: u64,
/// post migration token supply
pub post_migration_token_supply: u64,
/// migrated pool collect fee mode
pub migrated_collect_fee_mode: u8,
/// migrated dynamic fee option.
pub migrated_dynamic_fee: u8,
/// migrated pool fee in bps
pub migrated_pool_fee_bps: u16,
pub migrated_pool_base_fee_mode: u8,
pub enable_first_swap_with_min_fee: u8,
/// compounding fee bps for migrated DAMM v2 pool, should only be non-zero
/// if migrated_collect_fee_mode is 2 (Compounding)
pub migrated_compounding_fee_bps: u16,
/// pool creation fee in lamports value
pub pool_creation_fee: u64,
/// serialized MigratedPoolMarketCapFeeSchedulerParams, only used when
/// migrated_pool_base_fee_mode is market cap scheduler
pub migrated_pool_base_fee_bytes: [u8; 16],
/// minimum price
pub sqrt_start_price: u128,
/// curve, only use 20 point firstly, we can extend that latter
pub curve: [LiquidityDistributionConfig; 20],
}
impl PoolConfig {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.len() < 8 {
return None;
}
let discriminator = &data[0..8];
if discriminator != [26, 108, 14, 123, 116, 230, 129, 43] {
return None;
}
let mut data_slice = data;
data_slice = &data_slice[8..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}