mars/state/
treasury.rs

1use bytemuck::{Pod, Zeroable};
2use shank::ShankAccount;
3use solana_program::pubkey::Pubkey;
4
5use crate::{
6    impl_account_from_bytes, impl_to_bytes,
7    state::Hash,
8    utils::{AccountDiscriminator, Discriminator},
9};
10
11/// Treasury is a singleton account which manages all program wide variables.
12/// It is the mint authority for the Mars token and also the authority of the program-owned token account.
13#[repr(C)]
14#[derive(Clone, Copy, Debug, PartialEq, Pod, ShankAccount, Zeroable)]
15pub struct Treasury {
16    /// The admin authority with permission to update the difficulty.
17    pub admin: Pubkey,
18
19    /// The bump of the treasury account PDA, for signing CPIs.
20    pub bump: u64,
21
22    /// The hash difficulty.
23    pub difficulty: Hash,
24
25    /// The timestamp of the reset invocation.
26    pub last_reset_at: i64,
27
28    /// The reward rate to payout to miners for submiting valid hashes.
29    pub reward_rate: u64,
30
31    /// The total lifetime claimed rewards.
32    pub total_claimed_rewards: u64,
33}
34
35impl Discriminator for Treasury {
36    fn discriminator() -> AccountDiscriminator {
37        AccountDiscriminator::Treasury
38    }
39}
40
41impl_to_bytes!(Treasury);
42impl_account_from_bytes!(Treasury);