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