This commit is contained in:
Hardhat Chad
2025-09-17 14:45:13 -07:00
parent 69d0383cf6
commit fdcc5601bc
9 changed files with 81 additions and 104 deletions

View File

@@ -113,6 +113,27 @@ pub fn claim_ore(signer: Pubkey, amount: u64) -> Instruction {
}
}
pub fn redeem(signer: Pubkey, amount: u64) -> Instruction {
let mint_address = MINT_ADDRESS;
let sender_address = get_associated_token_address(&signer, &MINT_ADDRESS);
let treasury_address = TREASURY_ADDRESS;
Instruction {
program_id: crate::ID,
accounts: vec![
AccountMeta::new(signer, true),
AccountMeta::new(mint_address, false),
AccountMeta::new(sender_address, false),
AccountMeta::new(treasury_address, false),
AccountMeta::new_readonly(system_program::ID, false),
AccountMeta::new_readonly(spl_token::ID, false),
],
data: Redeem {
amount: amount.to_le_bytes(),
}
.to_bytes(),
}
}
// let [signer_info, board_info, mint_info, treasury_info, reserve_tokens_info, vault_info, system_program, token_program, slot_hashes_sysvar] =
pub fn reset(signer: Pubkey, miners: Vec<Pubkey>) -> Instruction {

View File

@@ -7,12 +7,12 @@ use super::OreAccount;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Board {
/// The commits for the round.
pub commits: [u64; 25],
/// The round number.
pub id: u64,
/// The prospects for the round.
pub prospects: [u64; 25],
/// The timestamp at which the block starts mining.
pub start_at: i64,
@@ -25,8 +25,8 @@ pub struct Board {
/// The hash of the end slot, provided by solana, used for random number generation.
pub slot_hash: [u8; 32],
/// The top winner of the round.
pub top_winner: Pubkey,
/// The top miner of the round.
pub top_miner: Pubkey,
/// The total amount of SOL prospected in the round.
pub total_prospects: u64,

View File

@@ -10,8 +10,8 @@ pub struct Miner {
/// The authority of this miner account.
pub authority: Pubkey,
/// The miner's committed square in the current round round.
pub commits: [u64; 25],
/// The miner's prospects in the current round.
pub prospects: [u64; 25],
/// The amount of SOL this miner can claim.
pub rewards_sol: u64,