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 SetOracleAuthority = 75,
60 InitCollection = 76,
61
62 Deposit = 10,
64 DepositWithSession = 48,
65 Withdraw = 11,
66 WithdrawWithSession = 47,
67 ClaimYield = 12,
68 ClaimYieldWithSession = 51,
69
70 Buyback = 13,
72 Wrap = 14,
73 SetAdmin = 16,
74 SetFeeCollector = 17,
75 SetSwapProgram = 18,
76 SetVarAddress = 19,
77 NewVar = 20,
78 SetAdminFee = 21,
79 Migrate = 26,
80 SetAuction = 33,
81 CreateWhitelist = 34,
82 SetTgeTimestamp = 35,
83 Liq = 37,
84 Barrel = 38,
85}
86
87#[repr(C)]
88#[derive(Clone, Copy, Debug, Pod, Zeroable)]
89pub struct Automate {
90 pub amount: [u8; 8],
91 pub deposit: [u8; 8],
92 pub fee: [u8; 8],
93 pub mask: [u8; 8],
94 pub strategy: u8,
95 pub reload: [u8; 8],
96 pub referrer: [u8; 32],
98 pub pooled: u8,
100}
101
102#[repr(C)]
103#[derive(Clone, Copy, Debug, Pod, Zeroable)]
104pub struct ClaimSOL {}
105
106#[repr(C)]
107#[derive(Clone, Copy, Debug, Pod, Zeroable)]
108pub struct ClaimOIL {}
109
110#[repr(C)]
111#[derive(Clone, Copy, Debug, Pod, Zeroable)]
112pub struct Deploy {
113 pub amount: [u8; 8],
114 pub squares: [u8; 4],
115 pub referrer: [u8; 32],
117 pub pooled: u8,
119}
120
121#[repr(C)]
122#[derive(Clone, Copy, Debug, Pod, Zeroable)]
123pub struct Log {}
124
125#[repr(C)]
126#[derive(Clone, Copy, Debug, Pod, Zeroable)]
127pub struct Reset {}
128
129#[repr(C)]
130#[derive(Clone, Copy, Debug, Pod, Zeroable)]
131pub struct Close {}
132
133#[repr(C)]
134#[derive(Clone, Copy, Debug, Pod, Zeroable)]
135pub struct SetAdmin {
136 pub admin: [u8; 32],
137}
138
139#[repr(C)]
140#[derive(Clone, Copy, Debug, Pod, Zeroable)]
141pub struct SetFeeCollector {
142 pub fee_collector: [u8; 32],
143}
144
145#[repr(C)]
146#[derive(Clone, Copy, Debug, Pod, Zeroable)]
147pub struct Buyback {}
148
149#[repr(C)]
150#[derive(Clone, Copy, Debug, Pod, Zeroable)]
151pub struct Liq {}
152
153#[repr(C)]
154#[derive(Clone, Copy, Debug, Pod, Zeroable)]
155pub struct Barrel {
156 pub amount: [u8; 8],
157}
158
159#[repr(C)]
160#[derive(Clone, Copy, Debug, Pod, Zeroable)]
161pub struct Wrap {
162 pub use_liquidity: u8,
164 pub amount: [u8; 8],
165}
166
167#[repr(C)]
168#[derive(Clone, Copy, Debug, Pod, Zeroable)]
169pub struct ReloadSOL {}
170
171#[repr(C)]
172#[derive(Clone, Copy, Debug, Pod, Zeroable)]
173pub struct Deposit {
174 pub amount: [u8; 8],
175 pub lock_duration_days: [u8; 8], pub stake_id: [u8; 8], }
178
179#[repr(C)]
180#[derive(Clone, Copy, Debug, Pod, Zeroable)]
181pub struct Withdraw {
182 pub amount: [u8; 8],
183 pub stake_id: [u8; 8],
184}
185
186#[repr(C)]
187#[derive(Clone, Copy, Debug, Pod, Zeroable)]
188pub struct ClaimYield {
189 pub amount: [u8; 8],
190}
191
192#[repr(C)]
193#[derive(Clone, Copy, Debug, Pod, Zeroable)]
194pub struct Checkpoint {}
195
196#[repr(C)]
197#[derive(Clone, Copy, Debug, Pod, Zeroable)]
198pub struct NewVar {
199 pub id: [u8; 8],
200 pub commit: [u8; 32],
201 pub samples: [u8; 8],
202}
203
204#[repr(C)]
205#[derive(Clone, Copy, Debug, Pod, Zeroable)]
206pub struct SetAdminFee {
207 pub admin_fee: [u8; 8],
208}
209
210#[repr(C)]
211#[derive(Clone, Copy, Debug, Pod, Zeroable)]
212pub struct SetSwapProgram {}
213
214#[repr(C)]
215#[derive(Clone, Copy, Debug, Pod, Zeroable)]
216pub struct SetVarAddress {}
217
218#[repr(C)]
219#[derive(Clone, Copy, Debug, Pod, Zeroable)]
220pub struct Migrate {}
221
222#[repr(C)]
223#[derive(Clone, Copy, Debug, Pod, Zeroable)]
224pub struct CreateReferral {}
225
226#[repr(C)]
227#[derive(Clone, Copy, Debug, Pod, Zeroable)]
228pub struct ClaimReferral {}
229
230#[repr(C)]
231#[derive(Clone, Copy, Debug, Pod, Zeroable)]
232pub struct CreateWhitelist {
233 pub code_hash: [u8; 32],
235}
236
237#[repr(C)]
238#[derive(Clone, Copy, Debug, Pod, Zeroable)]
239pub struct SetTgeTimestamp {
240 pub tge_timestamp: [u8; 8],
244}
245
246#[repr(C)]
247#[derive(Clone, Copy, Debug, Pod, Zeroable)]
248pub struct Initialize {
249 pub barrel_authority: [u8; 32],
250 pub fee_collector: [u8; 32],
251 pub swap_program: [u8; 32],
252 pub var_address: [u8; 32],
253 pub admin_fee: [u8; 8],
254 pub halving_period_seconds: [u8; 8],
256 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
258 pub starting_prices: [[u8; 8]; 4], }
260
261#[repr(C)]
262#[derive(Clone, Copy, Debug, Pod, Zeroable)]
263pub struct PlaceBid {
264 pub square_id: [u8; 8],
265 pub referrer: [u8; 32],
267}
268
269#[repr(C)]
270#[derive(Clone, Copy, Debug, Pod, Zeroable)]
271pub struct ClaimAuctionOIL {
272 pub well_mask: u8,
275}
276
277#[repr(C)]
278#[derive(Clone, Copy, Debug, Pod, Zeroable)]
279pub struct ClaimAuctionSOL {
280 pub _reserved: u8,
282}
283
284#[repr(C)]
285#[derive(Clone, Copy, Debug, Pod, Zeroable)]
286pub struct SetAuction {
287 pub halving_period_seconds: [u8; 8],
288 pub last_halving_time: [u8; 8],
289 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
291 pub starting_prices: [[u8; 8]; 4], pub well_id: [u8; 8], }
294
295#[repr(C)]
296#[derive(Clone, Copy, Debug, Pod, Zeroable)]
297pub struct Contribute {
298 pub well_id: [u8; 8],
300 pub amount: [u8; 8],
302}
303
304#[repr(C)]
305#[derive(Clone, Copy, Debug, Pod, Zeroable)]
306pub struct CheckpointAuction {
307 pub well_mask: u8,
310 pub epoch_ids: [[u8; 8]; 4],
314}
315
316instruction!(OilInstruction, Automate);
317instruction!(OilInstruction, Initialize);
318instruction!(OilInstruction, Checkpoint);
319instruction!(OilInstruction, ClaimSOL);
320instruction!(OilInstruction, ClaimOIL);
321instruction!(OilInstruction, ReloadSOL);
322instruction!(OilInstruction, Deploy);
323instruction!(OilInstruction, Log);
324instruction!(OilInstruction, Buyback);
325instruction!(OilInstruction, Wrap);
326instruction!(OilInstruction, Reset);
327instruction!(OilInstruction, Close);
328instruction!(OilInstruction, SetAdmin);
329instruction!(OilInstruction, SetFeeCollector);
330instruction!(OilInstruction, Deposit);
331instruction!(OilInstruction, Withdraw);
332instruction!(OilInstruction, ClaimYield);
333instruction!(OilInstruction, NewVar);
334instruction!(OilInstruction, SetAdminFee);
335instruction!(OilInstruction, SetSwapProgram);
336instruction!(OilInstruction, SetVarAddress);
337instruction!(OilInstruction, Migrate);
338instruction!(OilInstruction, CreateReferral);
339instruction!(OilInstruction, ClaimReferral);
340instruction!(OilInstruction, PlaceBid);
341instruction!(OilInstruction, ClaimAuctionOIL);
342instruction!(OilInstruction, ClaimAuctionSOL);
343instruction!(OilInstruction, SetAuction);
344instruction!(OilInstruction, CreateWhitelist);
345instruction!(OilInstruction, SetTgeTimestamp);
346instruction!(OilInstruction, Liq);
347instruction!(OilInstruction, Barrel);
348instruction!(OilInstruction, Contribute);
349instruction!(OilInstruction, CheckpointAuction);
350
351#[repr(C)]
353#[derive(Clone, Copy, Debug, Pod, Zeroable)]
354pub struct InitializeRefinery {
355 pub initial_emission: [u8; 8],
357 pub mining_powers: [[u8; 8]; 15],
359 pub fuel_requirements: [[u8; 8]; 15],
361 pub fuel_consumption_rates: [[u8; 8]; 15],
363 pub rig_supplies: [[u8; 8]; 15],
365}
366
367#[repr(C)]
368#[derive(Clone, Copy, Debug, Pod, Zeroable)]
369pub struct PurchasePlot {}
370
371#[repr(C)]
372#[derive(Clone, Copy, Debug, Pod, Zeroable)]
373pub struct UpgradePlot {
374 pub plot_level: [u8; 8],
375}
376
377#[repr(C)]
378#[derive(Clone, Copy, Debug, Pod, Zeroable)]
379pub struct PurchaseRig {
380 pub rig_type: [u8; 8],
381}
382
383#[repr(C)]
384#[derive(Clone, Copy, Debug, Pod, Zeroable)]
385pub struct PlaceRig {
386 pub rig_mint: [u8; 32],
387 pub slot: [u8; 8],
388}
389
390#[repr(C)]
391#[derive(Clone, Copy, Debug, Pod, Zeroable)]
392pub struct RemoveRig {
393 pub rig_mint: [u8; 32],
394}
395
396#[repr(C)]
397#[derive(Clone, Copy, Debug, Pod, Zeroable)]
398pub struct ClaimRefineryRewards {
399 pub fee_lamports: [u8; 8],
401}
402
403#[repr(C)]
404#[derive(Clone, Copy, Debug, Pod, Zeroable)]
405pub struct RefuelPlot {}
406
407#[repr(C)]
408#[derive(Clone, Copy, Debug, Pod, Zeroable)]
409pub struct SetRigConfig {
410 pub rig_type: [u8; 8],
411 pub mining_power: [u8; 8],
412 pub fuel_requirement: [u8; 8],
413 pub fuel_consumption_rate: [u8; 8],
414}
415
416#[repr(C)]
418#[derive(Clone, Copy, Debug, Pod, Zeroable)]
419pub struct InitOilOracle {
420 pub oracle_authority: [u8; 32],
422}
423
424#[repr(C)]
426#[derive(Clone, Copy, Debug, Pod, Zeroable)]
427pub struct SetOilOraclePrice {
428 pub price: [u8; 8],
429 pub expo: [u8; 4],
430 pub conf: [u8; 8],
431 pub ema: [u8; 8],
432 pub publish_time: [u8; 8],
433}
434
435#[repr(C)]
437#[derive(Clone, Copy, Debug, Pod, Zeroable)]
438pub struct SetOracleAuthority {
439 pub new_oracle_authority: [u8; 32],
441}
442
443instruction!(OilInstruction, InitializeRefinery);
444instruction!(OilInstruction, PurchasePlot);
445instruction!(OilInstruction, UpgradePlot);
446instruction!(OilInstruction, PurchaseRig);
447instruction!(OilInstruction, PlaceRig);
448instruction!(OilInstruction, RemoveRig);
449instruction!(OilInstruction, ClaimRefineryRewards);
450instruction!(OilInstruction, RefuelPlot);
451instruction!(OilInstruction, SetRigConfig);
452instruction!(OilInstruction, InitOilOracle);
453instruction!(OilInstruction, SetOilOraclePrice);
454instruction!(OilInstruction, SetOracleAuthority);
455
456#[repr(C)]
458#[derive(Clone, Copy, Debug, Pod, Zeroable)]
459pub struct InitCollection {}
460
461instruction!(OilInstruction, InitCollection);