ore_api/
instruction.rs

1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5pub enum OreInstruction {
6    // Miner
7    Automate = 0,
8    Checkpoint = 2,
9    ClaimSOL = 3,
10    ClaimORE = 4,
11    Close = 5,
12    Deploy = 6,
13    Log = 8,
14    Reset = 9,
15    RecycleSOL = 21,
16
17    // Staker
18    Deposit = 10,
19    Withdraw = 11,
20    ClaimYield = 12,
21
22    // Admin
23    Bury = 13,
24    Wrap = 14,
25    SetAdmin = 15,
26    SetFeeCollector = 16,
27    SetSwapProgram = 17,
28    SetVarAddress = 18,
29    NewVar = 19,
30    SetAdminFee = 20,
31    MigrateAutomation = 22,
32}
33
34#[repr(C)]
35#[derive(Clone, Copy, Debug, Pod, Zeroable)]
36pub struct Automate {
37    pub amount: [u8; 8],
38    pub deposit: [u8; 8],
39    pub fee: [u8; 8],
40    pub mask: [u8; 8],
41    pub strategy: u8,
42}
43
44#[repr(C)]
45#[derive(Clone, Copy, Debug, Pod, Zeroable)]
46pub struct ClaimSOL {}
47
48#[repr(C)]
49#[derive(Clone, Copy, Debug, Pod, Zeroable)]
50pub struct ClaimORE {}
51
52#[repr(C)]
53#[derive(Clone, Copy, Debug, Pod, Zeroable)]
54pub struct Deploy {
55    pub amount: [u8; 8],
56    pub squares: [u8; 4],
57}
58
59#[repr(C)]
60#[derive(Clone, Copy, Debug, Pod, Zeroable)]
61pub struct Log {}
62
63#[repr(C)]
64#[derive(Clone, Copy, Debug, Pod, Zeroable)]
65pub struct Reset {}
66
67#[repr(C)]
68#[derive(Clone, Copy, Debug, Pod, Zeroable)]
69pub struct Mine {
70    pub nonce: [u8; 8],
71}
72
73#[repr(C)]
74#[derive(Clone, Copy, Debug, Pod, Zeroable)]
75pub struct Swap {
76    pub amount: [u8; 8],
77    pub direction: u8,
78    pub precision: u8,
79    pub seed: [u8; 32],
80}
81
82#[repr(C)]
83#[derive(Clone, Copy, Debug, Pod, Zeroable)]
84pub struct Uncommit {
85    pub amount: [u8; 8],
86}
87
88#[repr(C)]
89#[derive(Clone, Copy, Debug, Pod, Zeroable)]
90pub struct SetAdmin {
91    pub admin: [u8; 32],
92}
93
94#[repr(C)]
95#[derive(Clone, Copy, Debug, Pod, Zeroable)]
96pub struct SetFeeCollector {
97    pub fee_collector: [u8; 32],
98}
99
100#[repr(C)]
101#[derive(Clone, Copy, Debug, Pod, Zeroable)]
102pub struct SetFeeRate {
103    pub fee_rate: [u8; 8],
104}
105
106#[repr(C)]
107#[derive(Clone, Copy, Debug, Pod, Zeroable)]
108pub struct Wrap {}
109
110#[repr(C)]
111#[derive(Clone, Copy, Debug, Pod, Zeroable)]
112pub struct Bury {}
113
114#[repr(C)]
115#[derive(Clone, Copy, Debug, Pod, Zeroable)]
116pub struct RecycleSOL {}
117
118#[repr(C)]
119#[derive(Clone, Copy, Debug, Pod, Zeroable)]
120pub struct Deposit {
121    pub amount: [u8; 8],
122}
123
124#[repr(C)]
125#[derive(Clone, Copy, Debug, Pod, Zeroable)]
126pub struct Withdraw {
127    pub amount: [u8; 8],
128}
129
130#[repr(C)]
131#[derive(Clone, Copy, Debug, Pod, Zeroable)]
132pub struct ClaimYield {
133    pub amount: [u8; 8],
134}
135
136#[repr(C)]
137#[derive(Clone, Copy, Debug, Pod, Zeroable)]
138pub struct Checkpoint {}
139
140#[repr(C)]
141#[derive(Clone, Copy, Debug, Pod, Zeroable)]
142pub struct Close {}
143
144#[repr(C)]
145#[derive(Clone, Copy, Debug, Pod, Zeroable)]
146pub struct NewVar {
147    pub id: [u8; 8],
148    pub commit: [u8; 32],
149    pub samples: [u8; 8],
150}
151
152#[repr(C)]
153#[derive(Clone, Copy, Debug, Pod, Zeroable)]
154pub struct SetAdminFee {
155    pub admin_fee: [u8; 8],
156}
157
158#[repr(C)]
159#[derive(Clone, Copy, Debug, Pod, Zeroable)]
160pub struct SetSwapProgram {}
161
162#[repr(C)]
163#[derive(Clone, Copy, Debug, Pod, Zeroable)]
164pub struct SetVarAddress {}
165
166#[repr(C)]
167#[derive(Clone, Copy, Debug, Pod, Zeroable)]
168pub struct MigrateAutomation {}
169
170instruction!(OreInstruction, Automate);
171instruction!(OreInstruction, Close);
172instruction!(OreInstruction, Checkpoint);
173instruction!(OreInstruction, ClaimSOL);
174instruction!(OreInstruction, ClaimORE);
175instruction!(OreInstruction, RecycleSOL);
176instruction!(OreInstruction, Deploy);
177instruction!(OreInstruction, Log);
178instruction!(OreInstruction, Wrap);
179instruction!(OreInstruction, Bury);
180instruction!(OreInstruction, Reset);
181instruction!(OreInstruction, SetAdmin);
182instruction!(OreInstruction, SetFeeCollector);
183instruction!(OreInstruction, Deposit);
184instruction!(OreInstruction, Withdraw);
185instruction!(OreInstruction, ClaimYield);
186instruction!(OreInstruction, NewVar);
187instruction!(OreInstruction, SetAdminFee);
188instruction!(OreInstruction, SetSwapProgram);
189instruction!(OreInstruction, SetVarAddress);
190instruction!(OreInstruction, MigrateAutomation);