oil_api/state/treasury.rs
1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use super::OilAccount;
5
6/// Treasury is a singleton account which is the mint authority for the OIL token and the authority of
7#[repr(C)]
8#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
9pub struct Treasury {
10 // The amount of SOL collected for buy-barrel operations.
11 pub balance: u64,
12
13 /// The amount of SOL in the gusher rewards pool.
14 pub gusher_sol: u64,
15
16 /// The cumulative OIL distributed to miners, divided by the total unclaimed OIL at the time of distribution.
17 pub block_rewards_factor: Numeric,
18
19 /// Buffer field (previously stake_rewards_factor, now in Pool).
20 pub buffer_a: Numeric,
21
22 /// The total amount of OIL barreled (burned) through buyback operations.
23 pub total_barrelled: u64,
24
25 /// The current total amount of refined OIL mining rewards.
26 pub block_total_refined: u64,
27
28 /// The total amount of SOL held in treasury for auction rewards (to be claimed by miners).
29 pub auction_rewards_sol: u64,
30
31 /// The current total amount of unclaimed OIL mining rewards.
32 pub block_total_unclaimed: u64,
33
34 /// Auction-based mining: The cumulative OIL distributed to miners, divided by the total unclaimed auction OIL at the time of distribution.
35 pub auction_rewards_factor: Numeric,
36
37 /// Auction-based mining: The current total amount of unclaimed auction OIL mining rewards.
38 pub auction_total_unclaimed: u64,
39
40 /// Auction-based mining: The current total amount of refined auction OIL mining rewards.
41 pub auction_total_refined: u64,
42
43 /// The amount of SOL used for liquidity & market making
44 pub liquidity: u64,
45}
46
47impl Treasury {
48 /// Credit auction rewards SOL to treasury (tracks total SOL available for claiming)
49 pub fn credit_auction_rewards_sol(&mut self, amount: u64) {
50 self.auction_rewards_sol += amount;
51 }
52}
53
54account!(OilAccount, Treasury);