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