sniper fee duration

This commit is contained in:
Hardhat Chad
2025-07-18 11:43:24 -07:00
parent b35d487b31
commit 5551ce1c7f
7 changed files with 30 additions and 40 deletions

View File

@@ -67,6 +67,9 @@ 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 INITIAL_SNIPER_FEE_DURATION: u64 = 100;
/// Window to submit hashes, in slots.
pub const MINING_WINDOW: u64 = 1500;

View File

@@ -54,9 +54,7 @@ pub struct Initialize {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct Log {
pub block_id: [u8; 8],
}
pub struct Log {}
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]

View File

@@ -2,16 +2,13 @@ use spl_associated_token_account::get_associated_token_address;
use steel::*;
use crate::{
consts::{BLOCK, MINT_ADDRESS, TREASURY_ADDRESS},
consts::{MARKET, MINT_ADDRESS, TREASURY_ADDRESS},
instruction::*,
state::*,
};
pub fn log(signer: Pubkey, block_id: u64, msg: &[u8]) -> Instruction {
let mut data = Log {
block_id: block_id.to_le_bytes(),
}
.to_bytes();
pub fn log(signer: Pubkey, msg: &[u8]) -> Instruction {
let mut data = Log {}.to_bytes();
data.extend_from_slice(msg);
Instruction {
program_id: crate::ID,
@@ -20,17 +17,8 @@ pub fn log(signer: Pubkey, block_id: u64, msg: &[u8]) -> Instruction {
}
}
pub fn program_log(
block_id: u64,
accounts: &[AccountInfo],
msg: &[u8],
) -> Result<(), ProgramError> {
invoke_signed(
&log(*accounts[0].key, block_id, msg),
accounts,
&crate::ID,
&[BLOCK, &block_id.to_le_bytes()],
)
pub fn program_log(accounts: &[AccountInfo], msg: &[u8]) -> Result<(), ProgramError> {
invoke_signed(&log(*accounts[0].key, msg), accounts, &crate::ID, &[MARKET])
}
pub fn mine(signer: Pubkey, authority: Pubkey, id: u64, nonce: u64) -> Instruction {

View File

@@ -13,6 +13,9 @@ pub struct Config {
// The block duration in slots.
pub block_duration: u64,
// The duration in slots for which the sniper fee is applied.
pub sniper_fee_duration: u64,
// The address that receives fees.
pub fee_collector: Pubkey,