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
16    // Staker
17    Deposit = 10,
18    Withdraw = 11,
19    ClaimYield = 12,
20
21    // Admin
22    Bury = 13,
23    Wrap = 14,
24    SetAdmin = 15,
25    SetFeeCollector = 16,
26    NewVar = 17,
27}
28
29#[repr(C)]
30#[derive(Clone, Copy, Debug, Pod, Zeroable)]
31pub struct Automate {
32    pub amount: [u8; 8],
33    pub deposit: [u8; 8],
34    pub fee: [u8; 8],
35    pub mask: [u8; 8],
36    pub strategy: u8,
37}
38
39#[repr(C)]
40#[derive(Clone, Copy, Debug, Pod, Zeroable)]
41pub struct ClaimSOL {}
42
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Pod, Zeroable)]
45pub struct ClaimORE {}
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
105#[repr(C)]
106#[derive(Clone, Copy, Debug, Pod, Zeroable)]
107pub struct Bury {}
108
109#[repr(C)]
110#[derive(Clone, Copy, Debug, Pod, Zeroable)]
111pub struct Deposit {
112    pub amount: [u8; 8],
113}
114
115#[repr(C)]
116#[derive(Clone, Copy, Debug, Pod, Zeroable)]
117pub struct Withdraw {
118    pub amount: [u8; 8],
119}
120
121#[repr(C)]
122#[derive(Clone, Copy, Debug, Pod, Zeroable)]
123pub struct ClaimYield {
124    pub amount: [u8; 8],
125}
126
127#[repr(C)]
128#[derive(Clone, Copy, Debug, Pod, Zeroable)]
129pub struct Checkpoint {}
130
131#[repr(C)]
132#[derive(Clone, Copy, Debug, Pod, Zeroable)]
133pub struct Close {}
134
135#[repr(C)]
136#[derive(Clone, Copy, Debug, Pod, Zeroable)]
137pub struct NewVar {
138    pub id: [u8; 8],
139    pub commit: [u8; 32],
140    pub samples: [u8; 8],
141}
142
143instruction!(OreInstruction, Automate);
144instruction!(OreInstruction, Close);
145instruction!(OreInstruction, Checkpoint);
146instruction!(OreInstruction, ClaimSOL);
147instruction!(OreInstruction, ClaimORE);
148instruction!(OreInstruction, Deploy);
149instruction!(OreInstruction, Log);
150instruction!(OreInstruction, Wrap);
151instruction!(OreInstruction, Bury);
152instruction!(OreInstruction, Reset);
153instruction!(OreInstruction, SetAdmin);
154instruction!(OreInstruction, SetFeeCollector);
155instruction!(OreInstruction, Deposit);
156instruction!(OreInstruction, Withdraw);
157instruction!(OreInstruction, ClaimYield);
158instruction!(OreInstruction, NewVar);