1use steel::*;
2use bytemuck;
3
4#[repr(u8)]
5#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
6pub enum OilInstruction {
7 Automate = 0,
9 AutomateWithSession = 40,
10 Initialize = 1,
11 Checkpoint = 2,
12 CheckpointWithSession = 52,
13 ClaimSOL = 3,
14 ClaimSOLWithSession = 44,
15 ClaimOIL = 4,
16 ClaimOILWithSession = 45,
17 Close = 5,
18 Deploy = 6,
19 DeployWithSession = 39,
20 Log = 8,
21 Reset = 9,
22 ReloadSOL = 22,
23 CreateReferral = 27,
24 CreateReferralWithSession = 49,
25 ClaimReferral = 28,
26 ClaimReferralWithSession = 50,
27
28 PlaceBid = 29,
30 PlaceBidWithSession = 41,
31 ClaimAuctionOIL = 31,
32 ClaimAuctionOILWithSession = 42,
33 ClaimAuctionSOL = 32,
34 ClaimAuctionSOLWithSession = 43,
35 Contribute = 53,
36 ContributeWithSession = 54,
37 CheckpointAuction = 55,
38 CheckpointAuctionWithSession = 56,
39
40 InitializeRefinery = 57,
42 PurchasePlot = 58,
43 UpgradePlot = 59,
44 PurchaseRig = 60,
45 PlaceRig = 61,
46 RemoveRig = 62,
47 ClaimRefineryRewards = 63,
48 RefuelPlot = 64,
49 SetRigConfig = 65,
50 PurchasePlotWithSession = 66,
51 UpgradePlotWithSession = 67,
52 PurchaseRigWithSession = 68,
53 PlaceRigWithSession = 69,
54 RemoveRigWithSession = 70,
55 RefuelPlotWithSession = 71,
56 ClaimRefineryRewardsWithSession = 72,
57 InitOilOracle = 73,
58 SetOilOraclePrice = 74,
59
60 Deposit = 10,
62 DepositWithSession = 48,
63 Withdraw = 11,
64 WithdrawWithSession = 47,
65 ClaimYield = 12,
66 ClaimYieldWithSession = 51,
67
68 Buyback = 13,
70 Wrap = 14,
71 SetAdmin = 16,
72 SetFeeCollector = 17,
73 SetSwapProgram = 18,
74 SetVarAddress = 19,
75 NewVar = 20,
76 SetAdminFee = 21,
77 Migrate = 26,
78 SetAuction = 33,
79 CreateWhitelist = 34,
80 SetTgeTimestamp = 35,
81 Liq = 37,
82 Barrel = 38,
83}
84
85#[repr(C)]
86#[derive(Clone, Copy, Debug, Pod, Zeroable)]
87pub struct Automate {
88 pub amount: [u8; 8],
89 pub deposit: [u8; 8],
90 pub fee: [u8; 8],
91 pub mask: [u8; 8],
92 pub strategy: u8,
93 pub reload: [u8; 8],
94 pub referrer: [u8; 32],
96 pub pooled: u8,
98}
99
100#[repr(C)]
101#[derive(Clone, Copy, Debug, Pod, Zeroable)]
102pub struct ClaimSOL {}
103
104#[repr(C)]
105#[derive(Clone, Copy, Debug, Pod, Zeroable)]
106pub struct ClaimOIL {}
107
108#[repr(C)]
109#[derive(Clone, Copy, Debug, Pod, Zeroable)]
110pub struct Deploy {
111 pub amount: [u8; 8],
112 pub squares: [u8; 4],
113 pub referrer: [u8; 32],
115 pub pooled: u8,
117}
118
119#[repr(C)]
120#[derive(Clone, Copy, Debug, Pod, Zeroable)]
121pub struct Log {}
122
123#[repr(C)]
124#[derive(Clone, Copy, Debug, Pod, Zeroable)]
125pub struct Reset {}
126
127#[repr(C)]
128#[derive(Clone, Copy, Debug, Pod, Zeroable)]
129pub struct Close {}
130
131#[repr(C)]
132#[derive(Clone, Copy, Debug, Pod, Zeroable)]
133pub struct SetAdmin {
134 pub admin: [u8; 32],
135}
136
137#[repr(C)]
138#[derive(Clone, Copy, Debug, Pod, Zeroable)]
139pub struct SetFeeCollector {
140 pub fee_collector: [u8; 32],
141}
142
143#[repr(C)]
144#[derive(Clone, Copy, Debug, Pod, Zeroable)]
145pub struct Buyback {}
146
147#[repr(C)]
148#[derive(Clone, Copy, Debug, Pod, Zeroable)]
149pub struct Liq {}
150
151#[repr(C)]
152#[derive(Clone, Copy, Debug, Pod, Zeroable)]
153pub struct Barrel {
154 pub amount: [u8; 8],
155}
156
157#[repr(C)]
158#[derive(Clone, Copy, Debug, Pod, Zeroable)]
159pub struct Wrap {
160 pub use_liquidity: u8,
162 pub amount: [u8; 8],
163}
164
165#[repr(C)]
166#[derive(Clone, Copy, Debug, Pod, Zeroable)]
167pub struct ReloadSOL {}
168
169#[repr(C)]
170#[derive(Clone, Copy, Debug, Pod, Zeroable)]
171pub struct Deposit {
172 pub amount: [u8; 8],
173 pub lock_duration_days: [u8; 8], pub stake_id: [u8; 8], }
176
177#[repr(C)]
178#[derive(Clone, Copy, Debug, Pod, Zeroable)]
179pub struct Withdraw {
180 pub amount: [u8; 8],
181 pub stake_id: [u8; 8],
182}
183
184#[repr(C)]
185#[derive(Clone, Copy, Debug, Pod, Zeroable)]
186pub struct ClaimYield {
187 pub amount: [u8; 8],
188}
189
190#[repr(C)]
191#[derive(Clone, Copy, Debug, Pod, Zeroable)]
192pub struct Checkpoint {}
193
194#[repr(C)]
195#[derive(Clone, Copy, Debug, Pod, Zeroable)]
196pub struct NewVar {
197 pub id: [u8; 8],
198 pub commit: [u8; 32],
199 pub samples: [u8; 8],
200}
201
202#[repr(C)]
203#[derive(Clone, Copy, Debug, Pod, Zeroable)]
204pub struct SetAdminFee {
205 pub admin_fee: [u8; 8],
206}
207
208#[repr(C)]
209#[derive(Clone, Copy, Debug, Pod, Zeroable)]
210pub struct SetSwapProgram {}
211
212#[repr(C)]
213#[derive(Clone, Copy, Debug, Pod, Zeroable)]
214pub struct SetVarAddress {}
215
216#[repr(C)]
217#[derive(Clone, Copy, Debug, Pod, Zeroable)]
218pub struct Migrate {}
219
220#[repr(C)]
221#[derive(Clone, Copy, Debug, Pod, Zeroable)]
222pub struct CreateReferral {}
223
224#[repr(C)]
225#[derive(Clone, Copy, Debug, Pod, Zeroable)]
226pub struct ClaimReferral {}
227
228#[repr(C)]
229#[derive(Clone, Copy, Debug, Pod, Zeroable)]
230pub struct CreateWhitelist {
231 pub code_hash: [u8; 32],
233}
234
235#[repr(C)]
236#[derive(Clone, Copy, Debug, Pod, Zeroable)]
237pub struct SetTgeTimestamp {
238 pub tge_timestamp: [u8; 8],
242}
243
244#[repr(C)]
245#[derive(Clone, Copy, Debug, Pod, Zeroable)]
246pub struct Initialize {
247 pub barrel_authority: [u8; 32],
248 pub fee_collector: [u8; 32],
249 pub swap_program: [u8; 32],
250 pub var_address: [u8; 32],
251 pub admin_fee: [u8; 8],
252 pub halving_period_seconds: [u8; 8],
254 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
256 pub starting_prices: [[u8; 8]; 4], }
258
259#[repr(C)]
260#[derive(Clone, Copy, Debug, Pod, Zeroable)]
261pub struct PlaceBid {
262 pub square_id: [u8; 8],
263 pub referrer: [u8; 32],
265}
266
267#[repr(C)]
268#[derive(Clone, Copy, Debug, Pod, Zeroable)]
269pub struct ClaimAuctionOIL {
270 pub well_mask: u8,
273}
274
275#[repr(C)]
276#[derive(Clone, Copy, Debug, Pod, Zeroable)]
277pub struct ClaimAuctionSOL {
278 pub _reserved: u8,
280}
281
282#[repr(C)]
283#[derive(Clone, Copy, Debug, Pod, Zeroable)]
284pub struct SetAuction {
285 pub halving_period_seconds: [u8; 8],
286 pub last_halving_time: [u8; 8],
287 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
289 pub starting_prices: [[u8; 8]; 4], pub well_id: [u8; 8], }
292
293#[repr(C)]
294#[derive(Clone, Copy, Debug, Pod, Zeroable)]
295pub struct Contribute {
296 pub well_id: [u8; 8],
298 pub amount: [u8; 8],
300}
301
302#[repr(C)]
303#[derive(Clone, Copy, Debug, Pod, Zeroable)]
304pub struct CheckpointAuction {
305 pub well_mask: u8,
308 pub epoch_ids: [[u8; 8]; 4],
312}
313
314instruction!(OilInstruction, Automate);
315instruction!(OilInstruction, Initialize);
316instruction!(OilInstruction, Checkpoint);
317instruction!(OilInstruction, ClaimSOL);
318instruction!(OilInstruction, ClaimOIL);
319instruction!(OilInstruction, ReloadSOL);
320instruction!(OilInstruction, Deploy);
321instruction!(OilInstruction, Log);
322instruction!(OilInstruction, Buyback);
323instruction!(OilInstruction, Wrap);
324instruction!(OilInstruction, Reset);
325instruction!(OilInstruction, Close);
326instruction!(OilInstruction, SetAdmin);
327instruction!(OilInstruction, SetFeeCollector);
328instruction!(OilInstruction, Deposit);
329instruction!(OilInstruction, Withdraw);
330instruction!(OilInstruction, ClaimYield);
331instruction!(OilInstruction, NewVar);
332instruction!(OilInstruction, SetAdminFee);
333instruction!(OilInstruction, SetSwapProgram);
334instruction!(OilInstruction, SetVarAddress);
335instruction!(OilInstruction, Migrate);
336instruction!(OilInstruction, CreateReferral);
337instruction!(OilInstruction, ClaimReferral);
338instruction!(OilInstruction, PlaceBid);
339instruction!(OilInstruction, ClaimAuctionOIL);
340instruction!(OilInstruction, ClaimAuctionSOL);
341instruction!(OilInstruction, SetAuction);
342instruction!(OilInstruction, CreateWhitelist);
343instruction!(OilInstruction, SetTgeTimestamp);
344instruction!(OilInstruction, Liq);
345instruction!(OilInstruction, Barrel);
346instruction!(OilInstruction, Contribute);
347instruction!(OilInstruction, CheckpointAuction);
348
349#[repr(C)]
351#[derive(Clone, Copy, Debug, Pod, Zeroable)]
352pub struct InitializeRefinery {
353 pub initial_emission: [u8; 8],
355 pub mining_powers: [[u8; 8]; 15],
357 pub fuel_requirements: [[u8; 8]; 15],
359 pub fuel_consumption_rates: [[u8; 8]; 15],
361 pub rig_supplies: [[u8; 8]; 15],
363}
364
365#[repr(C)]
366#[derive(Clone, Copy, Debug, Pod, Zeroable)]
367pub struct PurchasePlot {}
368
369#[repr(C)]
370#[derive(Clone, Copy, Debug, Pod, Zeroable)]
371pub struct UpgradePlot {
372 pub plot_level: [u8; 8],
373}
374
375#[repr(C)]
376#[derive(Clone, Copy, Debug, Pod, Zeroable)]
377pub struct PurchaseRig {
378 pub rig_type: [u8; 8],
379}
380
381#[repr(C)]
382#[derive(Clone, Copy, Debug, Pod, Zeroable)]
383pub struct PlaceRig {
384 pub rig_mint: [u8; 32],
385 pub slot: [u8; 8],
386}
387
388#[repr(C)]
389#[derive(Clone, Copy, Debug, Pod, Zeroable)]
390pub struct RemoveRig {
391 pub rig_mint: [u8; 32],
392}
393
394#[repr(C)]
395#[derive(Clone, Copy, Debug, Pod, Zeroable)]
396pub struct ClaimRefineryRewards {
397 pub fee_lamports: [u8; 8],
399}
400
401#[repr(C)]
402#[derive(Clone, Copy, Debug, Pod, Zeroable)]
403pub struct RefuelPlot {}
404
405#[repr(C)]
406#[derive(Clone, Copy, Debug, Pod, Zeroable)]
407pub struct SetRigConfig {
408 pub rig_type: [u8; 8],
409 pub mining_power: [u8; 8],
410 pub fuel_requirement: [u8; 8],
411 pub fuel_consumption_rate: [u8; 8],
412}
413
414#[repr(C)]
416#[derive(Clone, Copy, Debug, Pod, Zeroable)]
417pub struct InitOilOracle {
418 pub oracle_authority: [u8; 32],
420}
421
422#[repr(C)]
424#[derive(Clone, Copy, Debug, Pod, Zeroable)]
425pub struct SetOilOraclePrice {
426 pub price: [u8; 8],
427 pub expo: [u8; 4],
428 pub conf: [u8; 8],
429 pub ema: [u8; 8],
430 pub publish_time: [u8; 8],
431}
432
433instruction!(OilInstruction, InitializeRefinery);
434instruction!(OilInstruction, PurchasePlot);
435instruction!(OilInstruction, UpgradePlot);
436instruction!(OilInstruction, PurchaseRig);
437instruction!(OilInstruction, PlaceRig);
438instruction!(OilInstruction, RemoveRig);
439instruction!(OilInstruction, ClaimRefineryRewards);
440instruction!(OilInstruction, RefuelPlot);
441instruction!(OilInstruction, SetRigConfig);
442instruction!(OilInstruction, InitOilOracle);
443instruction!(OilInstruction, SetOilOraclePrice);