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}
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 Initialize {}
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 Deposit {
116    pub amount: [u8; 8],
117}
118
119#[repr(C)]
120#[derive(Clone, Copy, Debug, Pod, Zeroable)]
121pub struct Withdraw {
122    pub amount: [u8; 8],
123}
124
125#[repr(C)]
126#[derive(Clone, Copy, Debug, Pod, Zeroable)]
127pub struct ClaimYield {
128    pub amount: [u8; 8],
129}
130
131#[repr(C)]
132#[derive(Clone, Copy, Debug, Pod, Zeroable)]
133pub struct Checkpoint {}
134
135#[repr(C)]
136#[derive(Clone, Copy, Debug, Pod, Zeroable)]
137pub struct Close {}
138
139instruction!(OreInstruction, Automate);
140instruction!(OreInstruction, Close);
141instruction!(OreInstruction, Checkpoint);
142instruction!(OreInstruction, ClaimSOL);
143instruction!(OreInstruction, ClaimORE);
144instruction!(OreInstruction, Deploy);
145instruction!(OreInstruction, Initialize);
146instruction!(OreInstruction, Log);
147instruction!(OreInstruction, Wrap);
148instruction!(OreInstruction, Bury);
149instruction!(OreInstruction, Reset);
150instruction!(OreInstruction, SetAdmin);
151instruction!(OreInstruction, SetFeeCollector);
152instruction!(OreInstruction, Deposit);
153instruction!(OreInstruction, Withdraw);
154instruction!(OreInstruction, ClaimYield);