mystery block reward, sniper fee

This commit is contained in:
Hardhat Chad
2025-07-18 11:09:06 -07:00
parent acbb1be65f
commit 461505cd2c
12 changed files with 303 additions and 94 deletions

View File

@@ -58,12 +58,15 @@ pub const TREASURY_ADDRESS: Pubkey =
/// The address of the treasury account.
pub const TREASURY_BUMP: u8 = ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).1;
/// Denominator for protocol fee calculations.
pub const FEE_RATE_BPS: u64 = 100;
/// Swap fee in lamports.
pub const FEE_LAMPORTS: u64 = 1_000_000; // 0.001 SOL
/// Denominator for fee calculations.
pub const DENOMINATOR_BPS: u64 = 10_000;
/// Window to submit hashes, in slots.
pub const INITIAL_BLOCK_DURATION: u64 = 1500;
/// Window to submit hashes, in slots.
pub const MINING_WINDOW: u64 = 1500;
@@ -74,7 +77,7 @@ pub const SLOT_WINDOW: u64 = 4;
pub const HASHPOWER_LIQUIDITY: u64 = 1_000_000;
/// The ORE liquidity to seed the markets with.
pub const ORE_LIQUIDITY: u64 = ONE_ORE * 5;
pub const ORE_LIQUIDITY: u64 = ONE_ORE * 100;
/// The minimum difficulty required for payout.
pub const NUGGET_DIFFICULTY: u64 = 10;

View File

@@ -4,6 +4,7 @@ use steel::*;
#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
pub enum OreInstruction {
// User
Claim = 0,
Log = 1,
Mine = 2,
Swap = 3,
@@ -18,6 +19,12 @@ pub enum OreInstruction {
SetFeeRate = 10,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Claim {
pub amount: [u8; 8],
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Open {
@@ -89,6 +96,7 @@ pub struct SetFeeRate {
pub fee_rate: [u8; 8],
}
instruction!(OreInstruction, Claim);
instruction!(OreInstruction, Open);
instruction!(OreInstruction, Close);
instruction!(OreInstruction, Reset);

View File

@@ -134,7 +134,6 @@ account!(OreAccount, Market);
#[cfg(test)]
mod tests {
use crate::consts::FEE_RATE_BPS;
use super::*;
@@ -441,7 +440,7 @@ mod tests {
fee: FeeParams {
cumulative: 0,
uncollected: 0,
rate: FEE_RATE_BPS,
rate: 100, // 100 bps
},
snapshot: Snapshot {
enabled: 1,