This commit is contained in:
Hardhat Chad
2025-06-10 07:56:04 -07:00
parent 1ee9ad86ac
commit fb285226fb
55 changed files with 41 additions and 573 deletions

35
api/src/state/miner.rs Normal file
View File

@@ -0,0 +1,35 @@
use steel::*;
use crate::state::miner_pda;
use super::OreAccount;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Miner {
/// The authority of this miner account.
pub authority: Pubkey,
/// The ID of the last block this miner mined in.
pub block_id: u64,
/// The hash of the last block this miner mined in.
pub hash: [u8; 32],
/// The total number of hashes this miner has submitted.
pub total_hashes: u64,
/// The amount of ORE this miner has mined.
pub total_rewards: u64,
/// The number of winning hashes this miner has submitted.
pub winning_hashes: u64,
}
impl Miner {
pub fn pda(&self) -> (Pubkey, u8) {
miner_pda(self.authority)
}
}
account!(OreAccount, Miner);