This commit is contained in:
Hardhat Chad
2025-09-25 09:51:11 -07:00
parent 199d487afa
commit 91d51adcd3
9 changed files with 207 additions and 6 deletions

View File

@@ -18,9 +18,11 @@ pub enum OreInstruction {
Wrap = 10,
SetAdmin = 11,
SetFeeCollector = 12,
MigrateMiner = 13,
MigrateSquares = 14,
// Seeker
ClaimSeeker = 14,
ClaimSeeker = 15,
}
#[repr(C)]
@@ -121,6 +123,14 @@ pub struct Bury {
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct ClaimSeeker {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct MigrateMiner {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct MigrateSquares {}
instruction!(OreInstruction, Automate);
instruction!(OreInstruction, Boost);
instruction!(OreInstruction, ClaimSOL);
@@ -134,3 +144,5 @@ instruction!(OreInstruction, Reset);
instruction!(OreInstruction, SetAdmin);
instruction!(OreInstruction, SetFeeCollector);
instruction!(OreInstruction, ClaimSeeker);
instruction!(OreInstruction, MigrateMiner);
instruction!(OreInstruction, MigrateSquares);

View File

@@ -1,6 +1,6 @@
use steel::*;
use crate::state::miner_pda;
use crate::state::{miner_pda, OreAccountOLD};
use super::OreAccount;
@@ -36,6 +36,35 @@ pub struct Miner {
pub lifetime_rewards_ore: u64,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct MinerOLD {
/// The authority of this miner account.
pub authority: Pubkey,
/// The miner's prospects in the current round.
pub deployed: [u64; 25],
/// The executor with permmission to deploy capital with this account.
#[deprecated(note = "Use automation executor instead")]
pub executor: Pubkey,
/// The amount of SOL this miner can claim.
pub rewards_sol: u64,
/// The amount of ORE this miner can claim.
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 lifetime_rewards_ore: u64,
}
impl Miner {
pub fn pda(&self) -> (Pubkey, u8) {
miner_pda(self.authority)
@@ -43,3 +72,4 @@ impl Miner {
}
account!(OreAccount, Miner);
account!(OreAccountOLD, MinerOLD);

View File

@@ -29,6 +29,14 @@ pub enum OreAccount {
Square = 106,
}
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum OreAccountOLD {
MinerOLD = 103,
TreasuryOLD = 104,
SquareOLD = 106,
}
pub fn automation_pda(authority: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&[AUTOMATION, &authority.to_bytes()], &crate::ID)
}

View File

@@ -1,6 +1,6 @@
use steel::*;
use crate::state::square_pda;
use crate::state::{square_pda, OreAccountOLD};
use super::OreAccount;
@@ -17,6 +17,19 @@ pub struct Square {
pub miners: [[Pubkey; 16]; 25],
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct SquareOLD {
/// The count of miners on this square.
pub count: [u64; 25],
/// The deployments of all players.
pub deployed: [[u64; 16]; 25],
/// The miners in each square.
pub miners: [[Pubkey; 16]; 25],
}
impl Square {
pub fn pda() -> (Pubkey, u8) {
square_pda()
@@ -24,3 +37,4 @@ impl Square {
}
account!(OreAccount, Square);
account!(OreAccountOLD, SquareOLD);

View File

@@ -1,5 +1,7 @@
use steel::*;
use crate::state::OreAccountOLD;
use super::OreAccount;
/// Treasury is a singleton account which is the mint authority for the ORE token and the authority of
@@ -9,6 +11,17 @@ use super::OreAccount;
pub struct Treasury {
// The amount of SOL collected for buy-bury operations.
pub balance: u64,
/// The amount of ORE in the motherlode.
pub motherlode: u64,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct TreasuryOLD {
// The amount of SOL collected for buy-bury operations.
pub balance: u64,
}
account!(OreAccount, Treasury);
account!(OreAccountOLD, TreasuryOLD);