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

@@ -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);