Skip to main content

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    #[deprecated(since = "3.8.15", note = "Rolled into checkpoint")]
16    ReloadSOL = 21,
17
18    // Admin
19    Buyback = 13,
20    Bury = 24,
21    Wrap = 14,
22    SetAdmin = 15,
23    NewVar = 19,
24    Liq = 25,
25}
26
27#[repr(u8)]
28#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
29pub enum OreInstructionV2 {
30    AutomateV2 = 0,
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    pub reload: [u8; 8],
42}
43
44#[repr(C)]
45#[derive(Clone, Copy, Debug, Pod, Zeroable)]
46pub struct AutomateV2 {
47    pub amount: [u8; 8],
48    pub deposit: [u8; 8],
49    pub fee: [u8; 8],
50    pub mask: [u8; 8],
51    pub strategy: u8,
52    pub reload: [u8; 8],
53    pub conditions: [u8; 24],
54}
55
56#[repr(C)]
57#[derive(Clone, Copy, Debug, Pod, Zeroable)]
58pub struct ClaimSOL {}
59
60#[repr(C)]
61#[derive(Clone, Copy, Debug, Pod, Zeroable)]
62pub struct ClaimORE {
63    pub bps: [u8; 8],
64}
65
66#[repr(C)]
67#[derive(Clone, Copy, Debug, Pod, Zeroable)]
68pub struct Deploy {
69    pub amount: [u8; 8],
70    pub squares: [u8; 4],
71}
72
73#[repr(C)]
74#[derive(Clone, Copy, Debug, Pod, Zeroable)]
75pub struct Log {}
76
77#[repr(C)]
78#[derive(Clone, Copy, Debug, Pod, Zeroable)]
79pub struct Reset {}
80
81#[repr(C)]
82#[derive(Clone, Copy, Debug, Pod, Zeroable)]
83pub struct SetAdmin {
84    pub admin: [u8; 32],
85}
86
87#[repr(C)]
88#[derive(Clone, Copy, Debug, Pod, Zeroable)]
89pub struct SetFeeCollector {
90    pub fee_collector: [u8; 32],
91}
92
93#[repr(C)]
94#[derive(Clone, Copy, Debug, Pod, Zeroable)]
95pub struct SetFeeRate {
96    pub fee_rate: [u8; 8],
97}
98
99#[repr(C)]
100#[derive(Clone, Copy, Debug, Pod, Zeroable)]
101pub struct Wrap {
102    pub amount: [u8; 8],
103}
104
105#[repr(C)]
106#[derive(Clone, Copy, Debug, Pod, Zeroable)]
107pub struct Buyback {}
108
109#[repr(C)]
110#[derive(Clone, Copy, Debug, Pod, Zeroable)]
111pub struct Bury {
112    pub amount: [u8; 8],
113}
114
115#[deprecated(since = "3.8.15", note = "Rolled into checkpoint")]
116#[repr(C)]
117#[derive(Clone, Copy, Debug, Pod, Zeroable)]
118pub struct ReloadSOL {}
119
120#[repr(C)]
121#[derive(Clone, Copy, Debug, Pod, Zeroable)]
122pub struct Checkpoint {}
123
124#[repr(C)]
125#[derive(Clone, Copy, Debug, Pod, Zeroable)]
126pub struct Close {}
127
128#[repr(C)]
129#[derive(Clone, Copy, Debug, Pod, Zeroable)]
130pub struct NewVar {
131    pub id: [u8; 8],
132    pub commit: [u8; 32],
133    pub samples: [u8; 8],
134}
135
136#[repr(C)]
137#[derive(Clone, Copy, Debug, Pod, Zeroable)]
138pub struct SetAdminFee {
139    pub admin_fee: [u8; 8],
140}
141
142#[repr(C)]
143#[derive(Clone, Copy, Debug, Pod, Zeroable)]
144pub struct SetSwapProgram {}
145
146#[repr(C)]
147#[derive(Clone, Copy, Debug, Pod, Zeroable)]
148pub struct SetVarAddress {}
149
150instruction!(OreInstruction, Automate);
151instruction!(OreInstruction, Close);
152instruction!(OreInstruction, Checkpoint);
153instruction!(OreInstruction, ClaimSOL);
154instruction!(OreInstruction, ClaimORE);
155instruction!(OreInstruction, ReloadSOL);
156instruction!(OreInstruction, Deploy);
157instruction!(OreInstruction, Log);
158instruction!(OreInstruction, Wrap);
159instruction!(OreInstruction, Buyback);
160instruction!(OreInstruction, Bury);
161instruction!(OreInstruction, Reset);
162instruction!(OreInstruction, SetAdmin);
163instruction!(OreInstruction, NewVar);
164instruction!(OreInstructionV2, AutomateV2);