This commit is contained in:
Hardhat Chad
2025-07-16 16:51:23 -07:00
parent 084757cc8d
commit 39ff6f51cd
9 changed files with 213 additions and 457 deletions

View File

@@ -68,10 +68,10 @@ pub const DENOMINATOR_BPS: u64 = 10_000;
pub const SLOT_WINDOW: u64 = 4;
/// Amount of hash tokens to mint to market.
pub const HASH_TOKEN_SUPPLY: u64 = 1_000_000;
pub const HASHPOWER_LIQUIDITY: u64 = 1_000_000;
/// The virtual liquidity to seed the markets with (in ORE).
pub const VIRTUAL_LIQUIDITY: u64 = ONE_ORE * 5;
/// The ORE liquidity to seed the markets with.
pub const ORE_LIQUIDITY: u64 = ONE_ORE * 5;
/// The minimum difficulty required for payout.
pub const NUGGET_DIFFICULTY: u64 = 10;

View File

@@ -8,11 +8,14 @@ pub enum OreInstruction {
Mine = 2,
Swap = 3,
Initialize = 4,
Open = 5,
Close = 6,
Reset = 7,
// Admin
SetAdmin = 9,
SetFeeCollector = 10,
SetFeeRate = 11,
SetAdmin = 8,
SetFeeCollector = 9,
SetFeeRate = 10,
}
#[repr(C)]
@@ -25,6 +28,10 @@ pub struct Open {
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Close {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Reset {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Commit {
@@ -47,7 +54,7 @@ pub struct Log {
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Mine {
pub amount: [u8; 8],
pub nonce: [u8; 8],
}
#[repr(C)]
@@ -82,10 +89,13 @@ pub struct SetFeeRate {
pub fee_rate: [u8; 8],
}
instruction!(OreInstruction, Open);
instruction!(OreInstruction, Close);
instruction!(OreInstruction, Reset);
instruction!(OreInstruction, Initialize);
instruction!(OreInstruction, Log);
instruction!(OreInstruction, Mine);
instruction!(OreInstruction, Swap);
instruction!(OreInstruction, Initialize);
instruction!(OreInstruction, SetAdmin);
instruction!(OreInstruction, SetFeeCollector);
instruction!(OreInstruction, SetFeeRate);

View File

@@ -33,7 +33,7 @@ pub fn program_log(
)
}
pub fn mine(signer: Pubkey, authority: Pubkey, id: u64, amount: u64) -> Instruction {
pub fn mine(signer: Pubkey, authority: Pubkey, id: u64, nonce: u64) -> Instruction {
let block_adddress = block_pda(id).0;
let market_address = market_pda().0;
let miner_address = miner_pda(authority).0;
@@ -55,7 +55,7 @@ pub fn mine(signer: Pubkey, authority: Pubkey, id: u64, amount: u64) -> Instruct
AccountMeta::new_readonly(sysvar::slot_hashes::ID, false),
],
data: Mine {
amount: amount.to_le_bytes(),
nonce: nonce.to_le_bytes(),
}
.to_bytes(),
}