coal_api/state/
proof_v2.rs

1use bytemuck::{Pod, Zeroable};
2use solana_program::pubkey::Pubkey;
3
4
5use crate::utils::{impl_account_from_bytes, impl_to_bytes, Discriminator};
6
7
8use super::AccountDiscriminator;
9
10
11#[repr(C)]
12#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
13pub struct ProofV2 {
14    /// The resource mint this proof is for.
15    pub resource: Pubkey,
16
17    /// The signer authorized to use this proof.
18    pub authority: Pubkey,
19
20    /// The quantity of tokens this miner has staked or earned.
21    pub balance: u64,
22
23    /// The current mining challenge.
24    pub challenge: [u8; 32],
25
26    /// The last hash the miner provided.
27    pub last_hash: [u8; 32],
28
29    /// The last time this account provided a hash.
30    pub last_hash_at: i64,
31
32    /// The last time stake was deposited into this account.
33    pub last_stake_at: i64,
34
35    /// The keypair which has permission to submit hashes for mining.
36    pub miner: Pubkey,
37
38    /// The total lifetime hashes provided by this miner.
39    pub total_hashes: u64,
40
41    /// The total lifetime rewards distributed to this miner.
42    pub total_rewards: u64,
43
44    /// The tool equipped by the miner.
45    pub equipped_tool: Pubkey,
46}
47
48impl Discriminator for ProofV2 {
49    fn discriminator() -> u8 {
50        AccountDiscriminator::ProofV2.into()
51    }
52}
53
54impl_to_bytes!(ProofV2);
55impl_account_from_bytes!(ProofV2);