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