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
//! This code was AUTOGENERATED using the Codama library.
use {
crate::types::{PanicState, WrappedI80F48},
solana_pubkey::Pubkey,
};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct FeeState {
/// The fee state's own key. A PDA derived from just `b"feestate"`
pub key: Pubkey,
/// Can modify fees
pub global_fee_admin: Pubkey,
/// The base wallet for all protocol fees. All SOL fees go to this wallet.
/// All non-SOL fees go to the cannonical ATA of this wallet for that
/// asset.
pub global_fee_wallet: Pubkey,
pub placeholder0: u64,
/// Flat fee assessed when a new bank is initialized, in lamports.
/// * In SOL, in native decimals.
pub bank_init_flat_sol_fee: u32,
pub bump_seed: u8,
pub padding0: [u8; 3],
/// Liquidators can claim at this premium, when liquidating an asset in
/// receivership liquidation, e.g. (1 + this) * amount repaid >= asset
/// seized
/// * A percentage
pub liquidation_max_fee: WrappedI80F48,
/// Fee collected by the program owner from all groups
/// * A percentage
pub program_fee_fixed: WrappedI80F48,
/// Fee collected by the program owner from all groups
/// * A percentage
pub program_fee_rate: WrappedI80F48,
/// When the global admin pauses the protocol in the event of an emergency,
/// information about the pause duration will be stored here and
/// propagated to groups.
pub panic_state: PanicState,
pub placeholder1: u64,
/// Flat fee assessed for insurance/program use when a liquidation is
/// executed
/// * In SOL, in native decimals.
pub liquidation_flat_sol_fee: u32,
/// Flat fee assessed for preventing spam use when creating an order
/// * In SOL, in native decimals.
pub order_init_flat_sol_fee: u32,
/// Take-profit Orders can be executed at this premium, which Keepers are
/// allowed to keep (no pun intended) e.g. (1 + this) * amount repaid >=
/// asset seized
/// * A percentage
pub order_execution_max_fee: WrappedI80F48,
pub reserved1: [u8; 32],
}
impl FeeState {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.len() < 8 {
return None;
}
let discriminator = &data[0..8];
if discriminator != [63, 224, 16, 85, 193, 36, 235, 220] {
return None;
}
let mut data_slice = data;
data_slice = &data_slice[8..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}