mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-16 23:16:47 +00:00
48 lines
1.0 KiB
Rust
48 lines
1.0 KiB
Rust
use steel::*;
|
|
|
|
use crate::state::block_pda;
|
|
|
|
use super::OreAccount;
|
|
|
|
#[repr(C)]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
|
pub struct Block {
|
|
/// The block number.
|
|
pub id: u64,
|
|
|
|
/// The party that opened the block.
|
|
pub opener: Pubkey,
|
|
|
|
/// The reward configuration.
|
|
pub reward: u64,
|
|
|
|
/// The best hash submitted to the block.
|
|
pub best_hash: [u8; 32],
|
|
|
|
/// The authority of the miner who submitted the best hash.
|
|
pub best_hash_miner: Pubkey,
|
|
|
|
/// The timestamp at which the block starts mining.
|
|
pub start_at: i64,
|
|
|
|
/// The slot at which the block starts trading.
|
|
pub start_slot: u64,
|
|
|
|
/// The slot at which the block ends trading.
|
|
pub end_slot: u64,
|
|
|
|
/// The hash of the end slot, provided by solana, used for random number generation.
|
|
pub slot_hash: [u8; 32],
|
|
|
|
/// The total amount of hashpower bought in the block.
|
|
pub total_hashpower: u64,
|
|
}
|
|
|
|
impl Block {
|
|
pub fn pda(&self) -> (Pubkey, u8) {
|
|
block_pda(self.id)
|
|
}
|
|
}
|
|
|
|
account!(OreAccount, Block);
|