Skip to main content

ore_api/state/
config.rs

1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use crate::state::{config_pda, OreAccount};
5
6#[repr(C)]
7#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
8pub struct Config {
9    /// The admin config.
10    pub admin: AdminConfig,
11
12    /// The protocol config.
13    pub protocol: ProtocolConfig,
14}
15
16#[repr(C)]
17#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
18pub struct AdminConfig {
19    /// The authority of this admin config.
20    pub authority: Pubkey,
21
22    /// The address of the admin fee collector.
23    pub fee_collector: Pubkey,
24
25    /// The admin fee rate.
26    pub fee_rate: u64,
27}
28
29#[repr(C)]
30#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
31pub struct ProtocolConfig {
32    /// The authority of this protocol config.
33    pub authority: Pubkey,
34
35    /// The address of the protocol fee collector.
36    pub fee_collector: Pubkey,
37
38    /// The protocol fee rate.
39    pub fee_rate: u64,
40
41    /// The number of slots in the intermission period.
42    pub intermission_slots: u64,
43
44    /// The number of slots in a round.
45    pub round_slots: u64,
46
47    /// The address of the var account.
48    pub entropy_var_address: Pubkey,
49
50    /// The entropy program id.
51    pub entropy_program_id: Pubkey,
52}
53
54impl Config {
55    pub fn pda() -> (Pubkey, u8) {
56        config_pda()
57    }
58}
59
60account!(OreAccount, Config);