marsh-api 2.1.2

API for interacting with the MARSH program
Documentation
use bytemuck::{Pod, Zeroable};
use marsh_utils::*;
use solana_program::pubkey::Pubkey;

use crate::consts::CONFIG;

use super::MarshAccount;

/// Config is a singleton account which manages program global variables.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Config {
    /// The base reward rate paid out for a hash of minimum difficulty.
    pub base_reward_rate: u64,

    /// The timestamp of the last reset.
    pub last_reset_at: i64,

    /// The minimum accepted difficulty.
    pub min_difficulty: u64,

    /// The largest known stake balance on the network from the last epoch.
    pub top_balance: u64,

    /// The mars evolution authority with permission to update/change the evolver.
    /// The evolver decides the evolution fate of Mars
    pub evolver: Pubkey,

    /// Is mars evolvable, i.e. from mars to marsh.
    pub evolvable: u64,
}

/// Derive the PDA of the config account.
pub fn config_pda() -> (Pubkey, u8) {
    Pubkey::find_program_address(&[CONFIG], &crate::id())
}

account!(MarshAccount, Config);