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
//! 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()
}
}