This commit is contained in:
Hardhat Chad
2025-09-18 14:42:18 -07:00
parent 04940529f8
commit fbcdae6296
9 changed files with 63 additions and 132 deletions

View File

@@ -8,7 +8,6 @@ pub enum OreInstruction {
ClaimSOL = 1,
ClaimORE = 2,
Initialize = 3,
InitializeSquares = 4,
Prospect = 5,
Redeem = 6,
Reset = 7,
@@ -116,6 +115,10 @@ pub struct SetSniperFeeDuration {
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct ClaimSeeker {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct MigrateSquares {}
instruction!(OreInstruction, Boost);
instruction!(OreInstruction, ClaimSOL);
instruction!(OreInstruction, ClaimORE);
@@ -123,7 +126,6 @@ instruction!(OreInstruction, Redeem);
instruction!(OreInstruction, Reset);
instruction!(OreInstruction, Prospect);
instruction!(OreInstruction, Initialize);
instruction!(OreInstruction, InitializeSquares);
instruction!(OreInstruction, SetAdmin);
instruction!(OreInstruction, SetFeeCollector);
instruction!(OreInstruction, ClaimSeeker);

View File

@@ -54,44 +54,6 @@ pub fn initialize(signer: Pubkey) -> Instruction {
}
}
// let [signer_info, square_info, system_program] = accounts else {
pub fn initialize_squares(signer: Pubkey) -> Instruction {
Instruction {
program_id: crate::ID,
accounts: vec![
AccountMeta::new(signer, true),
AccountMeta::new_readonly(system_program::ID, false),
AccountMeta::new(square_pda(0).0, false),
AccountMeta::new(square_pda(1).0, false),
AccountMeta::new(square_pda(2).0, false),
AccountMeta::new(square_pda(3).0, false),
AccountMeta::new(square_pda(4).0, false),
AccountMeta::new(square_pda(5).0, false),
AccountMeta::new(square_pda(6).0, false),
AccountMeta::new(square_pda(7).0, false),
AccountMeta::new(square_pda(8).0, false),
AccountMeta::new(square_pda(9).0, false),
AccountMeta::new(square_pda(10).0, false),
AccountMeta::new(square_pda(11).0, false),
AccountMeta::new(square_pda(12).0, false),
AccountMeta::new(square_pda(13).0, false),
AccountMeta::new(square_pda(14).0, false),
AccountMeta::new(square_pda(15).0, false),
AccountMeta::new(square_pda(16).0, false),
AccountMeta::new(square_pda(17).0, false),
AccountMeta::new(square_pda(18).0, false),
AccountMeta::new(square_pda(19).0, false),
AccountMeta::new(square_pda(20).0, false),
AccountMeta::new(square_pda(21).0, false),
AccountMeta::new(square_pda(22).0, false),
AccountMeta::new(square_pda(23).0, false),
AccountMeta::new(square_pda(24).0, false),
],
data: InitializeSquares {}.to_bytes(),
}
}
pub fn claim_sol(signer: Pubkey, amount: u64) -> Instruction {
let miner_address = miner_pda(signer).0;
Instruction {
@@ -191,7 +153,7 @@ pub fn prospect(signer: Pubkey, fee_collector: Pubkey, amount: u64, square_id: u
let board_address = board_pda().0;
let config_address = config_pda().0;
let miner_address = miner_pda(signer).0;
let square_address = square_pda(square_id).0;
let square_address = square_pda(0).0;
Instruction {
program_id: crate::ID,
accounts: vec![

View File

@@ -26,6 +26,12 @@ pub enum OreAccount {
Square = 106,
}
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum OreAccountOLD {
SquareOLD = 106,
}
pub fn board_pda() -> (Pubkey, u8) {
Pubkey::find_program_address(&[BOARD], &crate::ID)
}

View File

@@ -1,12 +1,22 @@
use steel::*;
use crate::state::square_pda;
use crate::state::{square_pda, OreAccountOLD};
use super::OreAccount;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Square {
/// The count of miners on this square.
pub count: [usize; 25],
/// The miners in each 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,
@@ -20,10 +30,11 @@ pub struct Square {
pub miners: [Pubkey; 16],
}
impl Square {
pub fn pda(&self) -> (Pubkey, u8) {
square_pda(self.id)
}
}
// impl Square {
// pub fn pda() -> (Pubkey, u8) {
// square_pda()
// }
// }
account!(OreAccount, Square);
account!(OreAccountOLD, SquareOLD);