This commit is contained in:
Hardhat Chad
2025-09-25 20:03:03 -07:00
parent 8a29165789
commit 037aa5e480
7 changed files with 87 additions and 11 deletions

View File

@@ -32,6 +32,9 @@ pub const CONFIG: &[u8] = b"config";
/// The seed of the miner account PDA.
pub const MINER: &[u8] = b"miner";
/// The seed of the seeker account PDA.
pub const SEEKER: &[u8] = b"seeker";
/// The seed of the square account PDA.
pub const SQUARE: &[u8] = b"square";

View File

@@ -345,12 +345,16 @@ pub fn set_fee_collector(signer: Pubkey, fee_collector: Pubkey) -> Instruction {
}
pub fn claim_seeker(signer: Pubkey, mint: Pubkey) -> Instruction {
let seeker_address = seeker_pda(mint).0;
let token_account_address = get_associated_token_address(&signer, &mint);
Instruction {
program_id: crate::ID,
accounts: vec![
AccountMeta::new(signer, true),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(spl_token::ID, false),
AccountMeta::new(seeker_address, false),
AccountMeta::new(token_account_address, false),
AccountMeta::new_readonly(system_program::ID, false),
],
data: ClaimSeeker {}.to_bytes(),
}

View File

@@ -13,9 +13,12 @@ pub struct Miner {
/// The miner's prospects in the current round.
pub deployed: [u64; 25],
/// The executor with permmission to deploy capital with this account.
/// Unused buffer.
#[deprecated(note = "Use automation executor instead")]
pub executor: Pubkey,
pub buffer: [u8; 24],
/// Whether this miner is associated with a Solana Seeker.
pub is_seeker: u64,
/// The amount of SOL this miner has had refunded and may claim.
pub refund_sol: u64,

View File

@@ -2,6 +2,7 @@ mod automation;
mod board;
mod config;
mod miner;
mod seeker;
mod square;
mod treasury;
@@ -9,6 +10,7 @@ pub use automation::*;
pub use board::*;
pub use config::*;
pub use miner::*;
pub use seeker::*;
pub use square::*;
pub use treasury::*;
@@ -27,6 +29,7 @@ pub enum OreAccount {
//
Board = 105,
Square = 106,
Seeker = 107,
}
pub fn automation_pda(authority: Pubkey) -> (Pubkey, u8) {
@@ -45,6 +48,10 @@ pub fn miner_pda(authority: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&[MINER, &authority.to_bytes()], &crate::ID)
}
pub fn seeker_pda(mint: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&[SEEKER, &mint.to_bytes()], &crate::ID)
}
pub fn square_pda() -> (Pubkey, u8) {
Pubkey::find_program_address(&[SQUARE], &crate::ID)
}

13
api/src/state/seeker.rs Normal file
View File

@@ -0,0 +1,13 @@
use steel::*;
use super::OreAccount;
/// Seeker is an account which prevents multiple Seeker genesis tokens from being claimed.
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Seeker {
// The mint address of the Seeker token.
pub mint: Pubkey,
}
account!(OreAccount, Seeker);

View File

@@ -14,11 +14,4 @@ pub struct Treasury {
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);