oil_api/
consts.rs

1use const_crypto::ed25519;
2use solana_program::{pubkey, pubkey::Pubkey};
3
4/// The authority allowed to initialize the program.
5pub const ADMIN_ADDRESS: Pubkey = pubkey!("MAnTnweDD7eCsobn7AJucVHgk3YcKf6QWHGYSgqmbRJ");
6
7/// The decimal precision of the OIL token.
8/// There are 100 billion indivisible units per OIL (called "grams").
9pub const TOKEN_DECIMALS: u8 = 11;
10
11/// One OIL token, denominated in indivisible units.
12pub const ONE_OIL: u64 = 10u64.pow(TOKEN_DECIMALS as u32);
13
14/// The duration of one minute, in seconds.
15pub const ONE_MINUTE: i64 = 60;
16
17/// The duration of one hour, in seconds.
18pub const ONE_HOUR: i64 = 60 * ONE_MINUTE;
19
20/// The duration of one day, in seconds.
21pub const ONE_DAY: i64 = 24 * ONE_HOUR;
22
23/// The number of seconds for when the winning square expires.
24pub const ONE_WEEK: i64 = 7 * ONE_DAY;
25
26/// The number of slots in one week.
27pub const ONE_MINUTE_SLOTS: u64 = 150;
28
29/// The number of slots in one hour.
30pub const ONE_HOUR_SLOTS: u64 = 60 * ONE_MINUTE_SLOTS;
31
32/// The number of slots in 12 hours.
33pub const TWELVE_HOURS_SLOTS: u64 = 12 * ONE_HOUR_SLOTS;
34
35/// The number of slots in one day.
36pub const ONE_DAY_SLOTS: u64 = 24 * ONE_HOUR_SLOTS;
37
38/// The number of slots in one week.
39pub const ONE_WEEK_SLOTS: u64 = 7 * ONE_DAY_SLOTS;
40
41/// The number of slots for breather between rounds.
42pub const INTERMISSION_SLOTS: u64 = 35;
43
44/// The maximum token supply (21 million).
45/// Mirrors Bitcoin's 21M supply, representing a Solana-native store of value.
46pub const MAX_SUPPLY: u64 = ONE_OIL * 21_000_000;
47
48/// The seed of the automation account PDA.
49pub const AUTOMATION: &[u8] = b"automation";
50
51/// The seed of the board account PDA.
52pub const BOARD: &[u8] = b"board";
53
54/// The seed of the config account PDA.
55pub const CONFIG: &[u8] = b"config";
56
57/// The seed of the driller account PDA.
58pub const DRILLER: &[u8] = b"driller";
59
60/// The seed of the rig account PDA (auction-based mining).
61pub const RIG: &[u8] = b"rig";
62
63/// The seed of the referral account PDA.
64pub const REFERRAL: &[u8] = b"referral";
65
66/// The seed of the seeker account PDA.
67pub const SEEKER: &[u8] = b"seeker";
68
69/// The seed of the square account PDA.
70pub const SQUARE: &[u8] = b"square";
71
72/// The seed of the stake account PDA.
73pub const STAKE: &[u8] = b"stake";
74
75/// The seed of the round account PDA.
76pub const ROUND: &[u8] = b"round";
77
78/// The seed of the treasury account PDA.
79pub const TREASURY: &[u8] = b"treasury";
80
81/// The seed of the pool account PDA.
82pub const POOL: &[u8] = b"pool";
83
84/// The seed of the well account PDA.
85pub const WELL: &[u8] = b"well";
86
87/// The seed of the bid account PDA.
88pub const BID: &[u8] = b"bid";
89
90/// The seed of the auction account PDA.
91pub const AUCTION: &[u8] = b"auction";
92
93/// The seed of the square account PDA (auction state per well).
94pub const EPOCH: &[u8] = b"epoch";
95
96/// The seed of the auction pool account PDA (per-epoch pool contributions).
97pub const AUCTION_POOL: &[u8] = b"auction_pool";
98
99/// Program id for const pda derivations
100const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) };
101
102/// The address of the config account.
103pub const CONFIG_ADDRESS: Pubkey =
104    Pubkey::new_from_array(ed25519::derive_program_address(&[CONFIG], &PROGRAM_ID).0);
105
106/// The address of the mint account.
107pub const MINT_ADDRESS: Pubkey = pubkey!("oiLH2BP2Bi9zTocAYdjp676AEb7e3ZQtRSG3MxaKQFF");
108
109/// The address of the sol mint account.
110pub const SOL_MINT: Pubkey = pubkey!("So11111111111111111111111111111111111111112");
111
112/// The address to indicate OIL rewards are split between all drillers.
113pub const SPLIT_ADDRESS: Pubkey = pubkey!("SpLiT11111111111111111111111111111111111112");
114
115/// The address of the treasury account.
116pub const TREASURY_ADDRESS: Pubkey =
117    Pubkey::new_from_array(ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).0);
118
119/// The address of the treasury account.
120pub const TREASURY_BUMP: u8 = ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).1;
121
122/// Denominator for fee calculations.
123pub const DENOMINATOR_BPS: u64 = 10_000;
124
125/// The fee paid to bots if they checkpoint a user.
126pub const CHECKPOINT_FEE: u64 = 10_000; // 0.00001 SOL
127
128/// The fixed emission per round for block-based mining.
129pub const EMISSION_PER_ROUND: u64 = 200;