Skip to main content

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!("DEvGq2WVuA3qkSCtwwuMYThY4onkJunEHSAxU5cieph8");
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/// Refuel cost: OIL per fuel unit in atomic units (0.0003 OIL per fuel = 30_000_000 atomic).
15pub const REFUEL_RATE_ATOMIC: u64 = 30_000_000; // 0.0003 * 10^11
16
17/// The duration of one minute, in seconds.
18pub const ONE_MINUTE: i64 = 60;
19
20/// The duration of one hour, in seconds.
21pub const ONE_HOUR: i64 = 60 * ONE_MINUTE;
22
23/// The duration of one day, in seconds.
24pub const ONE_DAY: i64 = 24 * ONE_HOUR;
25
26/// The number of seconds for when the winning square expires.
27pub const ONE_WEEK: i64 = 7 * ONE_DAY;
28
29/// The duration of one slot in milliseconds.
30/// Fogo has ~40ms slots (10x faster than Solana's ~400ms slots)
31pub const SLOT_DURATION_MS: u64 = 40;
32
33/// The number of slots in one minute.
34/// Fogo has ~40ms slots, so 60 seconds = 1500 slots (60 / 0.04 = 1500)
35pub const ONE_MINUTE_SLOTS: u64 = 1500;
36
37/// The number of slots in one hour.
38pub const ONE_HOUR_SLOTS: u64 = 60 * ONE_MINUTE_SLOTS;
39
40/// The number of slots in 12 hours.
41pub const TWELVE_HOURS_SLOTS: u64 = 12 * ONE_HOUR_SLOTS;
42
43/// The number of slots in one day.
44pub const ONE_DAY_SLOTS: u64 = 24 * ONE_HOUR_SLOTS;
45
46/// The number of slots in one week.
47pub const ONE_WEEK_SLOTS: u64 = 7 * ONE_DAY_SLOTS;
48
49/// The number of slots for breather between rounds.
50pub const INTERMISSION_SLOTS: u64 = 300;
51
52/// The maximum token supply (21 million).
53/// Mirrors Bitcoin's 21M supply, representing a Solana-native store of value.
54pub const MAX_SUPPLY: u64 = ONE_OIL * 21_000_000;
55
56/// The seed of the automation account PDA.
57pub const AUTOMATION: &[u8] = b"automation";
58
59/// The seed of the board account PDA.
60pub const BOARD: &[u8] = b"board";
61
62/// The seed of the config account PDA.
63pub const CONFIG: &[u8] = b"config";
64
65/// The seed of the miner account PDA.
66pub const MINER: &[u8] = b"miner";
67
68/// The seed of the referral account PDA.
69pub const REFERRAL: &[u8] = b"referral";
70
71/// The seed of the stake account PDA.
72pub const STAKE: &[u8] = b"stake";
73
74/// The seed of the round account PDA.
75pub const ROUND: &[u8] = b"round";
76
77/// The seed of the treasury account PDA.
78pub const TREASURY: &[u8] = b"treasury";
79
80/// The seed of the pool account PDA.
81pub const POOL: &[u8] = b"pool";
82
83/// The seed of the well account PDA.
84pub const WELL: &[u8] = b"well";
85
86/// The seed of the auction account PDA.
87pub const AUCTION: &[u8] = b"auction";
88
89/// The seed of the whitelist account PDA.
90pub const WHITELIST: &[u8] = b"whitelist";
91
92/// The seed of the rig account PDA (auction-based mining).
93pub const RIG: &[u8] = b"rig";
94
95/// The seed of the micro account PDA (per-epoch auction state).
96pub const MICRO: &[u8] = b"micro";
97
98/// The seed of the share account PDA (per-user, per-epoch auction contribution).
99pub const SHARE: &[u8] = b"share";
100
101/// The seed of the plot account PDA (refinery system).
102pub const PLOT: &[u8] = b"plot";
103
104/// The seed of the refinery account PDA (refinery system).
105pub const REFINERY: &[u8] = b"refinery";
106
107/// The seed of the rig collection PDA (Metaplex collection update authority for verified rig NFTs).
108pub const RIG_COLLECTION: &[u8] = b"rig_collection";
109
110/// The seed of the OIL price oracle PDA (Valiant-backed, centralized updater).
111pub const ORACLE: &[u8] = b"oracle";
112
113/// Max age (seconds) of oracle price before considered stale for claim fee. 10 minutes.
114pub const MAX_ORACLE_PRICE_AGE_SEC: u32 = 600;
115
116/// Program id for const pda derivations
117const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) };
118
119/// The address of the config account.
120pub const CONFIG_ADDRESS: Pubkey =
121    Pubkey::new_from_array(ed25519::derive_program_address(&[CONFIG], &PROGRAM_ID).0);
122
123/// The address of the mint account.
124pub const MINT_ADDRESS: Pubkey = pubkey!("oiLTuhTJc9qRDr2FcMiCUBJ3BCunNXP1LGJCG7svBSy");
125
126/// The address of the sol mint account.
127pub const SOL_MINT: Pubkey = pubkey!("So11111111111111111111111111111111111111112");
128
129/// The address to indicate OIL rewards are split between all miners.
130pub const SPLIT_ADDRESS: Pubkey = pubkey!("SpLiT11111111111111111111111111111111111112");
131
132/// The address to indicate the mining pool won the lottery.
133pub const POOL_ADDRESS: Pubkey = pubkey!("PooL111111111111111111111111111111111111112");
134
135/// The address of the treasury account.
136pub const TREASURY_ADDRESS: Pubkey =
137    Pubkey::new_from_array(ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).0);
138
139/// The address of the treasury account.
140pub const TREASURY_BUMP: u8 = ed25519::derive_program_address(&[TREASURY], &PROGRAM_ID).1;
141
142/// Denominator for fee calculations.
143pub const DENOMINATOR_BPS: u64 = 10_000;
144
145/// The fee paid to bots if they checkpoint a user.
146pub const CHECKPOINT_FEE: u64 = 10_000; // 0.00001 SOL
147
148/// Minimum claim fee (lamports) for refinery rewards; ensures fee is never 0. 0.01 SOL.
149pub const MIN_REFINERY_CLAIM_FEE_LAMPORTS: u64 = 10_000_000;
150
151/// Minimum fee in lamports per 1 OIL (full token); prevents under-reporting price. 0.0001 SOL per OIL.
152/// Enforced: fee_lamports >= claimable_atomic * this / ONE_OIL (with 0.01 SOL absolute floor).
153pub const MIN_REFINERY_FEE_LAMPORTS_PER_FULL_OIL: u64 = 100_000;
154
155/// The fixed emission per round for block-based mining.
156pub const EMISSION_PER_ROUND: u64 = 200;
157
158/// The minimum cooldown period (in seconds) between auction OIL claims to prevent spam.
159pub const CLAIM_AUCTION_OIL_COOLDOWN_SECONDS: i64 = 10;
160
161/// The floor price for auction wells (in lamports).
162/// Price decays linearly from init_price down to this floor over auction_duration_seconds.
163/// Once price reaches floor, it stays at floor until someone bids.
164pub const AUCTION_FLOOR_PRICE: u64 = 10_000_000; // 0.01 SOL (testnet)
165
166/// The fee paid to the admin for each transaction.
167pub const ADMIN_FEE: u64 = 100; // 1%
168
169/// The address to receive the admin fee.
170pub const ADMIN_FEE_COLLECTOR: Pubkey = pubkey!("FEEFFuugN2rj9fcgrdoSfMdPFkRCfkpKi4vCGGYPyEVV");
171
172/// The swap program used for buybacks.
173pub const SWAP_PROGRAM: Pubkey = pubkey!("vnt1u7PzorND5JjweFWmDawKe2hLWoTwHU6QKz6XX98");
174
175/// The address of the var account.
176pub const VAR_ADDRESS: Pubkey = pubkey!("DQGNTK6bcSMgDQ73b5Fdg6xUwVmvzxP18v4sVdFpEHXb");
177
178/// The address which can call the bury and wrap instructions.
179pub const BURY_AUTHORITY: Pubkey = pubkey!("BoT3qYmE6xePWPU96Kf2QeuJr1pDgQ3gLWbA6kSyjzV");