Skip to main content

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