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}
45
46#[repr(C)]
47#[derive(Clone, Copy, Debug, Pod, Zeroable)]
48pub struct Automate {
49 pub amount: [u8; 8],
50 pub deposit: [u8; 8],
51 pub fee: [u8; 8],
52 pub mask: [u8; 8],
53 pub strategy: u8,
54 pub reload: [u8; 8],
55 pub referrer: [u8; 32],
57 pub pooled: u8,
59}
60
61#[repr(C)]
62#[derive(Clone, Copy, Debug, Pod, Zeroable)]
63pub struct InitRound {}
64
65#[repr(C)]
66#[derive(Clone, Copy, Debug, Pod, Zeroable)]
67pub struct ClaimSOL {}
68
69#[repr(C)]
70#[derive(Clone, Copy, Debug, Pod, Zeroable)]
71pub struct ClaimOIL {}
72
73#[repr(C)]
74#[derive(Clone, Copy, Debug, Pod, Zeroable)]
75pub struct ClaimSeeker {}
76
77#[repr(C)]
78#[derive(Clone, Copy, Debug, Pod, Zeroable)]
79pub struct Deploy {
80 pub amount: [u8; 8],
81 pub squares: [u8; 4],
82 pub referrer: [u8; 32],
84 pub pooled: u8,
86}
87
88#[repr(C)]
89#[derive(Clone, Copy, Debug, Pod, Zeroable)]
90pub struct Log {}
91
92#[repr(C)]
93#[derive(Clone, Copy, Debug, Pod, Zeroable)]
94pub struct Reset {}
95
96#[repr(C)]
97#[derive(Clone, Copy, Debug, Pod, Zeroable)]
98pub struct Close {}
99
100#[repr(C)]
101#[derive(Clone, Copy, Debug, Pod, Zeroable)]
102pub struct Mine {
103 pub nonce: [u8; 8],
104}
105
106#[repr(C)]
107#[derive(Clone, Copy, Debug, Pod, Zeroable)]
108pub struct Swap {
109 pub amount: [u8; 8],
110 pub direction: u8,
111 pub precision: u8,
112 pub seed: [u8; 32],
113}
114
115#[repr(C)]
116#[derive(Clone, Copy, Debug, Pod, Zeroable)]
117pub struct Uncommit {
118 pub amount: [u8; 8],
119}
120
121#[repr(C)]
122#[derive(Clone, Copy, Debug, Pod, Zeroable)]
123pub struct SetAdmin {
124 pub admin: [u8; 32],
125}
126
127#[repr(C)]
128#[derive(Clone, Copy, Debug, Pod, Zeroable)]
129pub struct SetFeeCollector {
130 pub fee_collector: [u8; 32],
131}
132
133#[repr(C)]
134#[derive(Clone, Copy, Debug, Pod, Zeroable)]
135pub struct SetFeeRate {
136 pub fee_rate: [u8; 8],
137}
138
139#[repr(C)]
140#[derive(Clone, Copy, Debug, Pod, Zeroable)]
141pub struct Buyback {}
142
143#[repr(C)]
144#[derive(Clone, Copy, Debug, Pod, Zeroable)]
145pub struct ReloadSOL {}
146
147#[repr(C)]
148#[derive(Clone, Copy, Debug, Pod, Zeroable)]
149pub struct Deposit {
150 pub amount: [u8; 8],
151 pub lock_duration_days: [u8; 8], pub stake_id: [u8; 8], }
154
155#[repr(C)]
156#[derive(Clone, Copy, Debug, Pod, Zeroable)]
157pub struct Withdraw {
158 pub amount: [u8; 8],
159 pub stake_id: [u8; 8],
160}
161
162#[repr(C)]
163#[derive(Clone, Copy, Debug, Pod, Zeroable)]
164pub struct ClaimYield {
165 pub amount: [u8; 8],
166}
167
168#[repr(C)]
169#[derive(Clone, Copy, Debug, Pod, Zeroable)]
170pub struct Checkpoint {}
171
172#[repr(C)]
173#[derive(Clone, Copy, Debug, Pod, Zeroable)]
174pub struct NewVar {
175 pub id: [u8; 8],
176 pub commit: [u8; 32],
177 pub samples: [u8; 8],
178}
179
180#[repr(C)]
181#[derive(Clone, Copy, Debug, Pod, Zeroable)]
182pub struct SetAdminFee {
183 pub admin_fee: [u8; 8],
184}
185
186#[repr(C)]
187#[derive(Clone, Copy, Debug, Pod, Zeroable)]
188pub struct SetSwapProgram {}
189
190#[repr(C)]
191#[derive(Clone, Copy, Debug, Pod, Zeroable)]
192pub struct SetVarAddress {}
193
194#[repr(C)]
195#[derive(Clone, Copy, Debug, Pod, Zeroable)]
196pub struct Migrate {}
197
198#[repr(C)]
199#[derive(Clone, Copy, Debug, Pod, Zeroable)]
200pub struct CreateReferral {}
201
202#[repr(C)]
203#[derive(Clone, Copy, Debug, Pod, Zeroable)]
204pub struct ClaimReferral {}
205
206#[repr(C)]
207#[derive(Clone, Copy, Debug, Pod, Zeroable)]
208pub struct CreateWhitelist {
209 pub code_hash: [u8; 32],
211}
212
213#[repr(C)]
214#[derive(Clone, Copy, Debug, Pod, Zeroable)]
215pub struct SetTgeTimestamp {
216 pub tge_timestamp: [u8; 8],
220}
221
222#[repr(C)]
223#[derive(Clone, Copy, Debug, Pod, Zeroable)]
224pub struct Initialize {
225 pub barrel_authority: [u8; 32],
226 pub fee_collector: [u8; 32],
227 pub swap_program: [u8; 32],
228 pub var_address: [u8; 32],
229 pub admin_fee: [u8; 8],
230 pub halving_period_seconds: [u8; 8],
232 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
234 pub starting_prices: [[u8; 8]; 4], }
236
237#[repr(C)]
238#[derive(Clone, Copy, Debug, Pod, Zeroable)]
239pub struct PlaceBid {
240 pub square_id: [u8; 8],
241 pub referrer: [u8; 32],
243}
244
245#[repr(C)]
246#[derive(Clone, Copy, Debug, Pod, Zeroable)]
247pub struct ClaimAuctionOIL {
248 pub well_mask: u8,
251}
252
253#[repr(C)]
254#[derive(Clone, Copy, Debug, Pod, Zeroable)]
255pub struct ClaimAuctionSOL {
256 pub _reserved: u8,
258}
259
260#[repr(C)]
261#[derive(Clone, Copy, Debug, Pod, Zeroable)]
262pub struct SetAuction {
263 pub halving_period_seconds: [u8; 8],
264 pub last_halving_time: [u8; 8],
265 pub base_mining_rates: [[u8; 8]; 4], pub auction_duration_seconds: [u8; 8],
267 pub starting_prices: [[u8; 8]; 4], pub well_id: [u8; 8], }
270
271#[repr(C)]
272#[derive(Clone, Copy, Debug, Pod, Zeroable)]
273pub struct JoinAuctionPool {
274 pub square_id: [u8; 8],
276 pub amount: [u8; 8],
278}
279
280impl JoinAuctionPool {
281 pub fn to_bytes(&self) -> Vec<u8> {
282 bytemuck::bytes_of(self).to_vec()
283 }
284}
285
286instruction!(OilInstruction, Automate);
287instruction!(OilInstruction, Initialize);
288instruction!(OilInstruction, Checkpoint);
289instruction!(OilInstruction, ClaimSOL);
290instruction!(OilInstruction, ClaimOIL);
291instruction!(OilInstruction, ClaimSeeker);
292instruction!(OilInstruction, ReloadSOL);
293instruction!(OilInstruction, Deploy);
294instruction!(OilInstruction, Log);
295instruction!(OilInstruction, Buyback);
296instruction!(OilInstruction, Reset);
297instruction!(OilInstruction, Close);
298instruction!(OilInstruction, SetAdmin);
299instruction!(OilInstruction, SetFeeCollector);
300instruction!(OilInstruction, Deposit);
301instruction!(OilInstruction, Withdraw);
302instruction!(OilInstruction, ClaimYield);
303instruction!(OilInstruction, NewVar);
304instruction!(OilInstruction, SetAdminFee);
305instruction!(OilInstruction, SetSwapProgram);
306instruction!(OilInstruction, SetVarAddress);
307instruction!(OilInstruction, Migrate);
308instruction!(OilInstruction, CreateReferral);
309instruction!(OilInstruction, ClaimReferral);
310instruction!(OilInstruction, PlaceBid);
311instruction!(OilInstruction, ClaimAuctionOIL);
312instruction!(OilInstruction, ClaimAuctionSOL);
313instruction!(OilInstruction, SetAuction);
314instruction!(OilInstruction, CreateWhitelist);
315instruction!(OilInstruction, SetTgeTimestamp);