1use steel::*;
2use bytemuck;
3
4#[repr(u8)]
5#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
6pub enum OilInstruction {
7 Automate = 0,
9 Initialize = 1,
10 Checkpoint = 2,
11 ClaimSOL = 3,
12 ClaimOIL = 4,
13 Close = 5,
14 Deploy = 6,
15 ClaimSeeker = 7,
16 Log = 8,
17 Reset = 9,
18 ReloadSOL = 21,
19 CreateReferral = 27,
20 ClaimReferral = 28,
21
22 PlaceBid = 29,
24 ClaimAuctionOIL = 31,
25 ClaimAuctionSOL = 32,
26
27 Deposit = 10,
29 Withdraw = 11,
30 ClaimYield = 12,
31
32 Buyback = 13,
34 SetAdmin = 15,
35 SetFeeCollector = 16,
36 SetSwapProgram = 17,
37 SetVarAddress = 18,
38 NewVar = 19,
39 SetAdminFee = 20,
40 Migrate = 26,
41 SetAuction = 33,
42 CreateWhitelist = 34,
43 SetTgeTimestamp = 35,
44 ResetWellPrices = 36,
45}
46
47#[repr(C)]
48#[derive(Clone, Copy, Debug, Pod, Zeroable)]
49pub struct Automate {
50 pub amount: [u8; 8],
51 pub deposit: [u8; 8],
52 pub fee: [u8; 8],
53 pub mask: [u8; 8],
54 pub strategy: u8,
55 pub reload: [u8; 8],
56 pub referrer: [u8; 32],
58 pub pooled: u8,
60}
61
62#[repr(C)]
63#[derive(Clone, Copy, Debug, Pod, Zeroable)]
64pub struct InitRound {}
65
66#[repr(C)]
67#[derive(Clone, Copy, Debug, Pod, Zeroable)]
68pub struct ClaimSOL {}
69
70#[repr(C)]
71#[derive(Clone, Copy, Debug, Pod, Zeroable)]
72pub struct ClaimOIL {}
73
74#[repr(C)]
75#[derive(Clone, Copy, Debug, Pod, Zeroable)]
76pub struct ClaimSeeker {}
77
78#[repr(C)]
79#[derive(Clone, Copy, Debug, Pod, Zeroable)]
80pub struct Deploy {
81 pub amount: [u8; 8],
82 pub squares: [u8; 4],
83 pub referrer: [u8; 32],
85 pub pooled: u8,
87}
88
89#[repr(C)]
90#[derive(Clone, Copy, Debug, Pod, Zeroable)]
91pub struct Log {}
92
93#[repr(C)]
94#[derive(Clone, Copy, Debug, Pod, Zeroable)]
95pub struct Reset {}
96
97#[repr(C)]
98#[derive(Clone, Copy, Debug, Pod, Zeroable)]
99pub struct Close {}
100
101#[repr(C)]
102#[derive(Clone, Copy, Debug, Pod, Zeroable)]
103pub struct Mine {
104 pub nonce: [u8; 8],
105}
106
107#[repr(C)]
108#[derive(Clone, Copy, Debug, Pod, Zeroable)]
109pub struct Swap {
110 pub amount: [u8; 8],
111 pub direction: u8,
112 pub precision: u8,
113 pub seed: [u8; 32],
114}
115
116#[repr(C)]
117#[derive(Clone, Copy, Debug, Pod, Zeroable)]
118pub struct Uncommit {
119 pub amount: [u8; 8],
120}
121
122#[repr(C)]
123#[derive(Clone, Copy, Debug, Pod, Zeroable)]
124pub struct SetAdmin {
125 pub admin: [u8; 32],
126}
127
128#[repr(C)]
129#[derive(Clone, Copy, Debug, Pod, Zeroable)]
130pub struct SetFeeCollector {
131 pub fee_collector: [u8; 32],
132}
133
134#[repr(C)]
135#[derive(Clone, Copy, Debug, Pod, Zeroable)]
136pub struct SetFeeRate {
137 pub fee_rate: [u8; 8],
138}
139
140#[repr(C)]
141#[derive(Clone, Copy, Debug, Pod, Zeroable)]
142pub struct Buyback {}
143
144#[repr(C)]
145#[derive(Clone, Copy, Debug, Pod, Zeroable)]
146pub struct ReloadSOL {}
147
148#[repr(C)]
149#[derive(Clone, Copy, Debug, Pod, Zeroable)]
150pub struct Deposit {
151 pub amount: [u8; 8],
152 pub lock_duration_days: [u8; 8], pub stake_id: [u8; 8], }
155
156#[repr(C)]
157#[derive(Clone, Copy, Debug, Pod, Zeroable)]
158pub struct Withdraw {
159 pub amount: [u8; 8],
160 pub stake_id: [u8; 8],
161}
162
163#[repr(C)]
164#[derive(Clone, Copy, Debug, Pod, Zeroable)]
165pub struct ClaimYield {
166 pub amount: [u8; 8],
167}
168
169#[repr(C)]
170#[derive(Clone, Copy, Debug, Pod, Zeroable)]
171pub struct Checkpoint {}
172
173#[repr(C)]
174#[derive(Clone, Copy, Debug, Pod, Zeroable)]
175pub struct NewVar {
176 pub id: [u8; 8],
177 pub commit: [u8; 32],
178 pub samples: [u8; 8],
179}
180
181#[repr(C)]
182#[derive(Clone, Copy, Debug, Pod, Zeroable)]
183pub struct SetAdminFee {
184 pub admin_fee: [u8; 8],
185}
186
187#[repr(C)]
188#[derive(Clone, Copy, Debug, Pod, Zeroable)]
189pub struct SetSwapProgram {}
190
191#[repr(C)]
192#[derive(Clone, Copy, Debug, Pod, Zeroable)]
193pub struct SetVarAddress {}
194
195#[repr(C)]
196#[derive(Clone, Copy, Debug, Pod, Zeroable)]
197pub struct Migrate {}
198
199#[repr(C)]
200#[derive(Clone, Copy, Debug, Pod, Zeroable)]
201pub struct CreateReferral {}
202
203#[repr(C)]
204#[derive(Clone, Copy, Debug, Pod, Zeroable)]
205pub struct ClaimReferral {}
206
207#[repr(C)]
208#[derive(Clone, Copy, Debug, Pod, Zeroable)]
209pub struct CreateWhitelist {
210 pub code_hash: [u8; 32],
212}
213
214#[repr(C)]
215#[derive(Clone, Copy, Debug, Pod, Zeroable)]
216pub struct SetTgeTimestamp {
217 pub tge_timestamp: [u8; 8],
221}
222
223#[repr(C)]
224#[derive(Clone, Copy, Debug, Pod, Zeroable)]
225pub struct Initialize {
226 pub barrel_authority: [u8; 32],
227 pub fee_collector: [u8; 32],
228 pub swap_program: [u8; 32],
229 pub var_address: [u8; 32],
230 pub admin_fee: [u8; 8],
231 pub halving_period_seconds: [u8; 8],
233 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
235 pub starting_prices: [[u8; 8]; 4], }
237
238#[repr(C)]
239#[derive(Clone, Copy, Debug, Pod, Zeroable)]
240pub struct PlaceBid {
241 pub square_id: [u8; 8],
242 pub referrer: [u8; 32],
244}
245
246#[repr(C)]
247#[derive(Clone, Copy, Debug, Pod, Zeroable)]
248pub struct ClaimAuctionOIL {
249 pub well_mask: u8,
252}
253
254#[repr(C)]
255#[derive(Clone, Copy, Debug, Pod, Zeroable)]
256pub struct ClaimAuctionSOL {
257 pub _reserved: u8,
259}
260
261#[repr(C)]
262#[derive(Clone, Copy, Debug, Pod, Zeroable)]
263pub struct SetAuction {
264 pub halving_period_seconds: [u8; 8],
265 pub last_halving_time: [u8; 8],
266 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
268 pub starting_prices: [[u8; 8]; 4], pub well_id: [u8; 8], }
271
272#[repr(C)]
273#[derive(Clone, Copy, Debug, Pod, Zeroable)]
274pub struct ResetWellPrices {
275 pub well_id: [u8; 8],
277}
278
279#[repr(C)]
280#[derive(Clone, Copy, Debug, Pod, Zeroable)]
281pub struct JoinAuctionPool {
282 pub square_id: [u8; 8],
284 pub amount: [u8; 8],
286}
287
288impl JoinAuctionPool {
289 pub fn to_bytes(&self) -> Vec<u8> {
290 bytemuck::bytes_of(self).to_vec()
291 }
292}
293
294instruction!(OilInstruction, Automate);
295instruction!(OilInstruction, Initialize);
296instruction!(OilInstruction, Checkpoint);
297instruction!(OilInstruction, ClaimSOL);
298instruction!(OilInstruction, ClaimOIL);
299instruction!(OilInstruction, ClaimSeeker);
300instruction!(OilInstruction, ReloadSOL);
301instruction!(OilInstruction, Deploy);
302instruction!(OilInstruction, Log);
303instruction!(OilInstruction, Buyback);
304instruction!(OilInstruction, Reset);
305instruction!(OilInstruction, Close);
306instruction!(OilInstruction, SetAdmin);
307instruction!(OilInstruction, SetFeeCollector);
308instruction!(OilInstruction, Deposit);
309instruction!(OilInstruction, Withdraw);
310instruction!(OilInstruction, ClaimYield);
311instruction!(OilInstruction, NewVar);
312instruction!(OilInstruction, SetAdminFee);
313instruction!(OilInstruction, SetSwapProgram);
314instruction!(OilInstruction, SetVarAddress);
315instruction!(OilInstruction, Migrate);
316instruction!(OilInstruction, CreateReferral);
317instruction!(OilInstruction, ClaimReferral);
318instruction!(OilInstruction, PlaceBid);
319instruction!(OilInstruction, ClaimAuctionOIL);
320instruction!(OilInstruction, ClaimAuctionSOL);
321instruction!(OilInstruction, SetAuction);
322instruction!(OilInstruction, CreateWhitelist);
323instruction!(OilInstruction, SetTgeTimestamp);
324instruction!(OilInstruction, ResetWellPrices);