Skip to main content

miner_api/
consts.rs

1use solana_program::{pubkey, pubkey::Pubkey};
2
3/// Token decimal places.
4pub const TOKEN_DECIMALS: u8 = 9;
5
6/// One token in native units.
7pub const ONE_TOKEN: u64 = 10u64.pow(TOKEN_DECIMALS as u32);
8
9/// Emission: 10 tokens per minute.
10pub const EMISSION_PER_MINUTE: u64 = 10 * ONE_TOKEN;
11
12/// Initial round length in seconds (lives in Config, tunable via
13/// update_config, from an "ORE feel" cadence to a frugal one).
14pub const INITIAL_ROUND_SECONDS: u64 = 60;
15
16/// Round length bounds for update_config.
17pub const MIN_ROUND_SECONDS: u64 = 10;
18pub const MAX_ROUND_SECONDS: u64 = 3600;
19
20/// Round budget for a given length: 10 tokens/min pro-rata.
21/// A round with no submissions = the emission lapses (nothing is minted).
22pub const fn round_budget(round_seconds: u64) -> u64 {
23    EMISSION_PER_MINUTE * round_seconds / 60
24}
25
26/// How many rounds back Round accounts are kept before they can be closed
27/// (rent recovery: the crank closes old rounds and recycles the float).
28/// 2880 rounds × 60 s = 2 days to settle a reward at launch settings.
29pub const ROUND_RETENTION: u64 = 2880;
30
31/// Initial minimum hash difficulty (leading zero bits).
32/// 20 bits ≈ 1M hashes: a few seconds on a desktop, a dozen or so on a
33/// weak CPU. Proof-of-liveness is meant to take a moment, not be a race.
34pub const INITIAL_MIN_DIFFICULTY: u64 = 20;
35
36/// Initial base weight (free tier) in native token units.
37/// Denominated purely in tokens: each 1 token of balance = +1% power over
38/// the base (100 tokens = 2×). Tuned via update_config.
39pub const INITIAL_BASE_WEIGHT: u64 = 100 * ONE_TOKEN;
40
41/// PDA seeds.
42pub const CONFIG_SEED: &[u8] = b"config";
43pub const TREASURY_SEED: &[u8] = b"treasury";
44pub const ROUND_SEED: &[u8] = b"round";
45pub const MINER_SEED: &[u8] = b"miner";
46
47/// External programs (canonical addresses).
48pub const SPL_TOKEN_PROGRAM_ID: Pubkey = pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
49pub const ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey =
50    pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
51pub const SYSTEM_PROGRAM_ID: Pubkey = pubkey!("11111111111111111111111111111111");
52pub const SLOT_HASHES_SYSVAR_ID: Pubkey =
53    pubkey!("SysvarS1otHashes111111111111111111111111111");
54
55/// MintTo instruction index in the SPL Token program.
56pub const SPL_TOKEN_MINT_TO_IX: u8 = 7;