smelter_api/state/
config.rs

1use bytemuck::{Pod, Zeroable};
2
3use crate::utils::{impl_account_from_bytes, impl_to_bytes, Discriminator};
4
5use super::AccountDiscriminator;
6
7/// Config is a singleton account which manages program global variables.
8#[repr(C)]
9#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
10pub struct Config {
11    /// The base reward rate paid out for a hash of minimum difficulty.
12    pub base_reward_rate: u64,
13
14    /// The timestamp of the last reset.
15    pub last_reset_at: i64,
16
17    /// The minimum accepted difficulty.
18    pub min_difficulty: u64,
19
20    /// The largest known stake balance on the network from the last epoch.
21    pub top_balance: u64,
22}
23
24impl Discriminator for Config {
25    fn discriminator() -> u8 {
26        AccountDiscriminator::Config.into()
27    }
28}
29
30impl_to_bytes!(Config);
31impl_account_from_bytes!(Config);