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