1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use bytemuck::{Pod, Zeroable};
use shank::ShankAccount;
use solana_program::pubkey::Pubkey;

use crate::{
    impl_account_from_bytes, impl_to_bytes,
    state::Hash,
    utils::{AccountDiscriminator, Discriminator},
};

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, ShankAccount, Zeroable)]
pub struct Treasury {
    /// The admin authority with permission to update the difficulty.
    pub admin: Pubkey,

    /// The bump of the treasury account PDA.
    pub bump: u64,

    /// The hash difficulty.
    pub difficulty: Hash,

    /// The timestamp of the start of the current epoch.
    pub epoch_start_at: i64,

    /// The reward rate to payout to miners for submiting valid hashes.
    pub reward_rate: u64,

    /// The total lifetime claimed rewards.
    pub total_claimed_rewards: u64,
}

impl Discriminator for Treasury {
    fn discriminator() -> AccountDiscriminator {
        AccountDiscriminator::Treasury
    }
}

impl_to_bytes!(Treasury);
impl_account_from_bytes!(Treasury);