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