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}
32
33#[repr(C)]
34#[derive(Clone, Copy, Debug, Pod, Zeroable)]
35pub struct Automate {
36    pub amount: [u8; 8],
37    pub deposit: [u8; 8],
38    pub fee: [u8; 8],
39    pub mask: [u8; 8],
40    pub strategy: u8,
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
109#[repr(C)]
110#[derive(Clone, Copy, Debug, Pod, Zeroable)]
111pub struct Bury {}
112
113#[repr(C)]
114#[derive(Clone, Copy, Debug, Pod, Zeroable)]
115pub struct RecycleSOL {}
116
117#[repr(C)]
118#[derive(Clone, Copy, Debug, Pod, Zeroable)]
119pub struct Deposit {
120    pub amount: [u8; 8],
121}
122
123#[repr(C)]
124#[derive(Clone, Copy, Debug, Pod, Zeroable)]
125pub struct Withdraw {
126    pub amount: [u8; 8],
127}
128
129#[repr(C)]
130#[derive(Clone, Copy, Debug, Pod, Zeroable)]
131pub struct ClaimYield {
132    pub amount: [u8; 8],
133}
134
135#[repr(C)]
136#[derive(Clone, Copy, Debug, Pod, Zeroable)]
137pub struct Checkpoint {}
138
139#[repr(C)]
140#[derive(Clone, Copy, Debug, Pod, Zeroable)]
141pub struct Close {}
142
143#[repr(C)]
144#[derive(Clone, Copy, Debug, Pod, Zeroable)]
145pub struct NewVar {
146    pub id: [u8; 8],
147    pub commit: [u8; 32],
148    pub samples: [u8; 8],
149}
150
151#[repr(C)]
152#[derive(Clone, Copy, Debug, Pod, Zeroable)]
153pub struct SetAdminFee {
154    pub admin_fee: [u8; 8],
155}
156
157#[repr(C)]
158#[derive(Clone, Copy, Debug, Pod, Zeroable)]
159pub struct SetSwapProgram {}
160
161#[repr(C)]
162#[derive(Clone, Copy, Debug, Pod, Zeroable)]
163pub struct SetVarAddress {}
164
165instruction!(OreInstruction, Automate);
166instruction!(OreInstruction, Close);
167instruction!(OreInstruction, Checkpoint);
168instruction!(OreInstruction, ClaimSOL);
169instruction!(OreInstruction, ClaimORE);
170instruction!(OreInstruction, RecycleSOL);
171instruction!(OreInstruction, Deploy);
172instruction!(OreInstruction, Log);
173instruction!(OreInstruction, Wrap);
174instruction!(OreInstruction, Bury);
175instruction!(OreInstruction, Reset);
176instruction!(OreInstruction, SetAdmin);
177instruction!(OreInstruction, SetFeeCollector);
178instruction!(OreInstruction, Deposit);
179instruction!(OreInstruction, Withdraw);
180instruction!(OreInstruction, ClaimYield);
181instruction!(OreInstruction, NewVar);
182instruction!(OreInstruction, SetAdminFee);
183instruction!(OreInstruction, SetSwapProgram);
184instruction!(OreInstruction, SetVarAddress);