marsh_api/state/
config.rs

1use bytemuck::{Pod, Zeroable};
2use marsh_utils::*;
3use solana_program::pubkey::Pubkey;
4
5use crate::consts::CONFIG;
6
7use super::MarshAccount;
8
9/// Config is a singleton account which manages program global variables.
10#[repr(C)]
11#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
12pub struct Config {
13    /// The base reward rate paid out for a hash of minimum difficulty.
14    pub base_reward_rate: u64,
15
16    /// The timestamp of the last reset.
17    pub last_reset_at: i64,
18
19    /// The minimum accepted difficulty.
20    pub min_difficulty: u64,
21
22    /// The largest known stake balance on the network from the last epoch.
23    pub top_balance: u64,
24
25    /// The mars evolution authority with permission to update/change the evolver.
26    /// The evolver decides the evolution fate of Mars
27    pub evolver: Pubkey,
28
29    /// Is mars evolvable, i.e. from mars to marsh.
30    pub evolvable: u64,
31}
32
33/// Derive the PDA of the config account.
34pub fn config_pda() -> (Pubkey, u8) {
35    Pubkey::find_program_address(&[CONFIG], &crate::id())
36}
37
38account!(MarshAccount, Config);