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    Initialize = 7,
14    Log = 8,
15    Reset = 9,
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    SetIsNewRngEnabled = 17,
28
29    // Seeker
30    ClaimSeeker = 18,
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 Initialize {}
61
62#[repr(C)]
63#[derive(Clone, Copy, Debug, Pod, Zeroable)]
64pub struct Log {}
65
66#[repr(C)]
67#[derive(Clone, Copy, Debug, Pod, Zeroable)]
68pub struct Reset {}
69
70#[repr(C)]
71#[derive(Clone, Copy, Debug, Pod, Zeroable)]
72pub struct Mine {
73    pub nonce: [u8; 8],
74}
75
76#[repr(C)]
77#[derive(Clone, Copy, Debug, Pod, Zeroable)]
78pub struct Swap {
79    pub amount: [u8; 8],
80    pub direction: u8,
81    pub precision: u8,
82    pub seed: [u8; 32],
83}
84
85#[repr(C)]
86#[derive(Clone, Copy, Debug, Pod, Zeroable)]
87pub struct Uncommit {
88    pub amount: [u8; 8],
89}
90
91#[repr(C)]
92#[derive(Clone, Copy, Debug, Pod, Zeroable)]
93pub struct SetAdmin {
94    pub admin: [u8; 32],
95}
96
97#[repr(C)]
98#[derive(Clone, Copy, Debug, Pod, Zeroable)]
99pub struct SetFeeCollector {
100    pub fee_collector: [u8; 32],
101}
102
103#[repr(C)]
104#[derive(Clone, Copy, Debug, Pod, Zeroable)]
105pub struct SetFeeRate {
106    pub fee_rate: [u8; 8],
107}
108
109#[repr(C)]
110#[derive(Clone, Copy, Debug, Pod, Zeroable)]
111pub struct Wrap {}
112
113#[repr(C)]
114#[derive(Clone, Copy, Debug, Pod, Zeroable)]
115pub struct Bury {}
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 ClaimSeeker {}
138
139#[repr(C)]
140#[derive(Clone, Copy, Debug, Pod, Zeroable)]
141pub struct Checkpoint {}
142
143#[repr(C)]
144#[derive(Clone, Copy, Debug, Pod, Zeroable)]
145pub struct Close {}
146
147#[repr(C)]
148#[derive(Clone, Copy, Debug, Pod, Zeroable)]
149pub struct SetIsNewRngEnabled {
150    pub is_new_rng_enabled: u8,
151}
152
153instruction!(OreInstruction, Automate);
154instruction!(OreInstruction, Close);
155instruction!(OreInstruction, Checkpoint);
156instruction!(OreInstruction, ClaimSOL);
157instruction!(OreInstruction, ClaimORE);
158instruction!(OreInstruction, Deploy);
159instruction!(OreInstruction, Initialize);
160instruction!(OreInstruction, Log);
161instruction!(OreInstruction, Wrap);
162instruction!(OreInstruction, Bury);
163instruction!(OreInstruction, Reset);
164instruction!(OreInstruction, SetAdmin);
165instruction!(OreInstruction, SetFeeCollector);
166instruction!(OreInstruction, Deposit);
167instruction!(OreInstruction, Withdraw);
168instruction!(OreInstruction, ClaimYield);
169instruction!(OreInstruction, ClaimSeeker);
170instruction!(OreInstruction, SetIsNewRngEnabled);