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 drillers, divided by the total unclaimed OIL at the time of distribution.
18 pub driller_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 drilling rewards.
27 pub total_refined: u64,
28
29 /// The total amount of SOL held in treasury for auction rewards (to be claimed by drillers).
30 pub auction_rewards_sol: u64,
31
32 /// The current total amount of unclaimed OIL drilling rewards.
33 pub total_unclaimed: u64,
34
35 /// Auction-based mining: The cumulative OIL distributed to drillers, divided by the total unclaimed auction OIL at the time of distribution.
36 pub auction_driller_rewards_factor: Numeric,
37
38 /// Auction-based mining: The current total amount of unclaimed auction OIL drilling rewards.
39 pub auction_total_unclaimed: u64,
40
41 /// Auction-based mining: The current total amount of refined auction OIL drilling 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);