oil_api/
event.rs

1use serde::{Deserialize, Serialize};
2use steel::*;
3
4pub enum OilEvent {
5    Reset = 0,
6    Barrel = 1,
7    Deploy = 2,
8    Liq = 3,
9    Bid = 4,
10    JoinPool = 5,
11    ClaimAuctionOIL = 6,
12    ClaimAuctionSOL = 7,
13}
14
15#[repr(C)]
16#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
17pub struct ResetEvent {
18    /// The event discriminator.
19    pub disc: u64,
20
21    /// The block that was opened for trading.
22    pub round_id: u64,
23
24    /// The start slot of the next block.
25    pub start_slot: u64,
26
27    /// The end slot of the next block.
28    pub end_slot: u64,
29
30    /// The winning square of the round.
31    pub winning_square: u64,
32
33    /// The top miner of the round.
34    pub top_miner: Pubkey,
35
36    /// The number of miners on the winning square.
37    pub num_winners: u64,
38
39    /// The total amount of SOL prospected in the round.
40    pub total_deployed: u64,
41
42    /// The total amount of SOL put in the OIL vault.
43    pub total_vaulted: u64,
44
45    /// The total amount of SOL won by miners for the round.
46    pub total_winnings: u64,
47
48    /// The total amount of OIL minted for the round.
49    pub total_minted: u64,
50
51    /// The timestamp of the event.
52    pub ts: i64,
53
54    /// The amount of SOL in the gusher.
55    pub gusher_sol: u64,
56}
57
58#[repr(C)]
59#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
60pub struct BarrelEvent {
61    /// The event discriminator.
62    pub disc: u64,
63
64    /// The amount of OIL barreled.
65    pub oil_barreled: u64,
66
67    /// The amount of OIL shared with stakers.
68    pub oil_shared: u64,
69
70    /// The amount of SOL swapped.
71    pub sol_amount: u64,
72
73    /// The new circulating supply of OIL.
74    pub new_circulating_supply: u64,
75
76    /// The timestamp of the event.
77    pub ts: i64,
78}
79
80#[repr(C)]
81#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
82pub struct DeployEvent {
83    /// The event discriminator.
84    pub disc: u64,
85
86    /// The authority of the deployer.
87    pub authority: Pubkey,
88
89    /// The amount of SOL deployed per square.
90    pub amount: u64,
91
92    /// The mask of the squares deployed to.
93    pub mask: u64,
94
95    /// The round id.
96    pub round_id: u64,
97
98    /// The signer of the deployer.
99    pub signer: Pubkey,
100
101    /// The strategy used by the autominer (u64::MAX if manual).
102    pub strategy: u64,
103
104    /// The total number of squares deployed to.
105    pub total_squares: u64,
106
107    /// The timestamp of the event.
108    pub ts: i64,
109}
110
111#[repr(C)]
112#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
113pub struct LiqEvent {
114    /// The event discriminator.
115    pub disc: u64,
116
117    /// The amount of SOL sent to the liq manager.
118    pub sol_amount: u64,
119
120    /// The recipient of the SOL.
121    pub recipient: Pubkey,
122
123    /// The timestamp of the event.
124    pub ts: i64,
125}
126
127#[repr(C)]
128#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
129pub struct BidEvent {
130    /// The event discriminator.
131    pub disc: u64,
132    
133    /// The authority of the bidder.
134    pub authority: Pubkey,
135    
136    /// The square ID (well) that was bid on (0-3).
137    pub square_id: u64,
138    
139    /// The bid amount in lamports.
140    pub bid_amount: u64,
141    
142    /// The current price at time of bid (in lamports).
143    pub current_price: u64,
144    
145    /// The previous owner (Pubkey::default() if no previous owner).
146    pub previous_owner: Pubkey,
147    
148    /// The accumulated OIL transferred to previous owner (0 if no previous owner).
149    pub accumulated_oil_transferred: u64,
150    
151    /// The new starting price for next auction (in lamports).
152    pub new_start_price: u64,
153    
154    /// The timestamp of the event.
155    pub ts: u64,
156}
157
158#[repr(C)]
159#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
160pub struct JoinAuctionPoolEvent {
161    /// The event discriminator.
162    pub disc: u64,
163    
164    /// The authority of the contributor.
165    pub authority: Pubkey,
166    
167    /// The square ID (well) for this pool contribution (0-3).
168    pub square_id: u64,
169    
170    /// The contribution amount in lamports.
171    pub contribution: u64,
172    
173    /// The total pool amount after this contribution (in lamports).
174    pub pool_total: u64,
175    
176    /// The current price at time of contribution (in lamports).
177    pub current_price: u64,
178    
179    /// The timestamp of the event.
180    pub ts: u64,
181    
182    /// Whether the pool won the well (auto-bid triggered).
183    /// 0 = false, 1 = true (using u64 for Pod compatibility and alignment)
184    pub pool_won: u64,
185}
186
187#[repr(C)]
188#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
189pub struct ClaimAuctionOILEvent {
190    /// The event discriminator.
191    pub disc: u64,
192    
193    /// The authority of the claimant.
194    pub authority: Pubkey,
195    
196    /// The total OIL claimed (after refining fees).
197    pub oil_claimed: u64,
198    
199    /// The refining fee charged (10%).
200    pub refining_fee: u64,
201    
202    /// The timestamp of the event.
203    pub ts: u64,
204}
205
206#[repr(C)]
207#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
208pub struct ClaimAuctionSOLEvent {
209    /// The event discriminator.
210    pub disc: u64,
211    
212    /// The authority of the claimant.
213    pub authority: Pubkey,
214    
215    /// The total SOL claimed (rewards + refunds).
216    pub sol_claimed: u64,
217    
218    /// The SOL from auction rewards (being outbid).
219    pub rewards_sol: u64,
220    
221    /// The SOL from pool refunds.
222    pub refunds_sol: u64,
223    
224    /// The timestamp of the event.
225    pub ts: u64,
226}
227
228event!(ResetEvent);
229event!(BarrelEvent);
230event!(DeployEvent);
231event!(LiqEvent);
232event!(BidEvent);
233event!(JoinAuctionPoolEvent);
234event!(ClaimAuctionOILEvent);
235event!(ClaimAuctionSOLEvent);