oil_api/state/config.rs
1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use crate::state::config_pda;
5
6use super::OilAccount;
7
8#[repr(C)]
9#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
10pub struct Config {
11 /// The address that can update the config.
12 pub admin: Pubkey,
13
14 /// The adress with authority to call wrap and barrel.
15 pub barrel_authority: Pubkey,
16
17 /// The address that receives admin fees.
18 pub fee_collector: Pubkey,
19
20 /// The program to be used for protocol swaps.
21 pub swap_program: Pubkey,
22
23 /// The address of the entropy var account.
24 pub var_address: Pubkey,
25
26 /// Amount to pay to fee collector (bps)
27 pub admin_fee: u64,
28
29 /// Current emission week (used for automatic weekly halving)
30 /// Week 0 = 50 OIL, Week 1 = 40 OIL, Week 2 = 30 OIL, Week 3 = 20 OIL, Week 4+ = 10 OIL
31 pub emission_week: u64,
32
33 /// Timestamp when the last emission week was updated (for automatic weekly progression)
34 pub last_emission_week_update: u64,
35}
36
37impl Config {
38 pub fn pda() -> (Pubkey, u8) {
39 config_pda()
40 }
41}
42
43account!(OilAccount, Config);