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