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