This commit is contained in:
Hardhat Chad
2025-09-17 14:15:13 -07:00
parent 959fd70c44
commit 69d0383cf6
17 changed files with 350 additions and 168 deletions

View File

@@ -25,13 +25,16 @@ pub struct Board {
/// The hash of the end slot, provided by solana, used for random number generation.
pub slot_hash: [u8; 32],
/// The total amount of ORE burned for the round.
pub total_burned: u64,
/// The top winner of the round.
pub top_winner: Pubkey,
/// The total amount of ORE committed for the round.
pub total_commits: u64,
/// The total amount of SOL prospected in the round.
pub total_prospects: u64,
/// The total amount of ORE won by miners for the round.
/// The total amount of SOL put in the ORE vault.
pub total_vaulted: u64,
/// The total amount of SOL won by miners for the round.
pub total_winnings: u64,
}

View File

@@ -13,14 +13,20 @@ pub struct Miner {
/// The miner's committed square in the current round round.
pub commits: [u64; 25],
/// The amount of SOL this miner can claim.
pub rewards_sol: u64,
/// The amount of ORE this miner can claim.
pub rewards: u64,
pub rewards_ore: u64,
/// The ID of the round this miner last played in.
pub round_id: u64,
/// The total amount of SOL this miner has mined across all blocks.
pub lifetime_rewards_sol: u64,
/// The total amount of ORE this miner has mined across all blocks.
pub total_rewards: u64,
pub lifetime_rewards_ore: u64,
}
impl Miner {

View File

@@ -42,15 +42,15 @@ pub fn square_pda(id: u64) -> (Pubkey, u8) {
Pubkey::find_program_address(&[SQUARE, &id.to_le_bytes()], &crate::ID)
}
pub fn vault_address() -> Pubkey {
let board_address = board_pda().0;
spl_associated_token_account::get_associated_token_address(&board_address, &MINT_ADDRESS)
}
// pub fn vault_address() -> Pubkey {
// let board_address = board_pda().0;
// spl_associated_token_account::get_associated_token_address(&board_address, &MINT_ADDRESS)
// }
pub fn treasury_pda() -> (Pubkey, u8) {
Pubkey::find_program_address(&[TREASURY], &crate::ID)
}
// pub fn treasury_tokens_address() -> Pubkey {
// spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
// }
pub fn treasury_tokens_address() -> Pubkey {
spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
}

View File

@@ -8,7 +8,9 @@ use super::OreAccount;
/// the program's global token account.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Treasury {}
pub struct Treasury {
pub balance: u64,
}
impl Treasury {
pub fn pda() -> (Pubkey, u8) {