ore_boost_api/
instruction.rs

1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5#[rustfmt::skip]
6pub enum BoostInstruction {
7    // User
8    Claim = 0,
9    Close = 1,
10    Deposit = 2,
11    Open = 3,
12    Withdraw = 5,
13    
14    // Admin
15    Activate = 100,
16    Deactivate = 101,
17    Initialize = 102,
18    New = 103,
19    UpdateAdmin = 104,
20    UpdateBoost = 105,
21
22    // Migration
23    MigrateConfig = 200,
24    MigrateBoost = 201,
25}
26
27impl BoostInstruction {
28    pub fn to_vec(&self) -> Vec<u8> {
29        vec![*self as u8]
30    }
31}
32
33#[repr(C)]
34#[derive(Clone, Copy, Debug, Pod, Zeroable)]
35pub struct Activate {}
36
37#[repr(C)]
38#[derive(Clone, Copy, Debug, Pod, Zeroable)]
39pub struct Claim {
40    pub amount: [u8; 8],
41}
42
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Pod, Zeroable)]
45pub struct Close {}
46
47#[repr(C)]
48#[derive(Clone, Copy, Debug, Pod, Zeroable)]
49pub struct Deactivate {}
50
51#[repr(C)]
52#[derive(Clone, Copy, Debug, Pod, Zeroable)]
53pub struct Deposit {
54    pub amount: [u8; 8],
55}
56
57#[repr(C)]
58#[derive(Clone, Copy, Debug, Pod, Zeroable)]
59pub struct Initialize {}
60
61#[repr(C)]
62#[derive(Clone, Copy, Debug, Pod, Zeroable)]
63pub struct New {
64    pub expires_at: [u8; 8],
65    pub weight: [u8; 8],
66}
67
68#[repr(C)]
69#[derive(Clone, Copy, Debug, Pod, Zeroable)]
70pub struct Open {}
71
72#[repr(C)]
73#[derive(Clone, Copy, Debug, Pod, Zeroable)]
74pub struct UpdateAdmin {
75    pub new_admin: Pubkey,
76}
77
78#[repr(C)]
79#[derive(Clone, Copy, Debug, Pod, Zeroable)]
80pub struct UpdateBoost {
81    pub expires_at: [u8; 8],
82    pub weight: [u8; 8],
83}
84
85#[repr(C)]
86#[derive(Clone, Copy, Debug, Pod, Zeroable)]
87pub struct Withdraw {
88    pub amount: [u8; 8],
89}
90
91#[repr(C)]
92#[derive(Clone, Copy, Debug, Pod, Zeroable)]
93pub struct MigrateConfig {}
94
95#[repr(C)]
96#[derive(Clone, Copy, Debug, Pod, Zeroable)]
97pub struct MigrateBoost {}
98
99instruction!(BoostInstruction, Activate);
100instruction!(BoostInstruction, Claim);
101instruction!(BoostInstruction, Close);
102instruction!(BoostInstruction, Deactivate);
103instruction!(BoostInstruction, Deposit);
104instruction!(BoostInstruction, Initialize);
105instruction!(BoostInstruction, New);
106instruction!(BoostInstruction, Open);
107instruction!(BoostInstruction, UpdateAdmin);
108instruction!(BoostInstruction, UpdateBoost);
109instruction!(BoostInstruction, Withdraw);
110instruction!(BoostInstruction, MigrateConfig);
111instruction!(BoostInstruction, MigrateBoost);