ore_api/
instruction.rs

1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5pub enum OreInstruction {
6    // User
7    Claim = 0,
8    Close = 1,
9    Mine = 2,
10    Open = 3,
11    Reset = 4,
12    Update = 5,
13
14    // Admin
15    Initialize = 100,
16}
17
18#[repr(C)]
19#[derive(Clone, Copy, Debug, Pod, Zeroable)]
20pub struct Claim {
21    pub amount: [u8; 8],
22}
23
24#[repr(C)]
25#[derive(Clone, Copy, Debug, Pod, Zeroable)]
26pub struct Close {}
27
28#[repr(C)]
29#[derive(Clone, Copy, Debug, Pod, Zeroable)]
30pub struct Mine {
31    pub digest: [u8; 16],
32    pub nonce: [u8; 8],
33}
34
35#[repr(C)]
36#[derive(Clone, Copy, Debug, Pod, Zeroable)]
37pub struct Open {}
38
39#[repr(C)]
40#[derive(Clone, Copy, Debug, Pod, Zeroable)]
41pub struct Reset {}
42
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Pod, Zeroable)]
45pub struct Update {}
46
47#[repr(C)]
48#[derive(Clone, Copy, Debug, Pod, Zeroable)]
49pub struct Initialize {}
50
51instruction!(OreInstruction, Claim);
52instruction!(OreInstruction, Close);
53instruction!(OreInstruction, Mine);
54instruction!(OreInstruction, Open);
55instruction!(OreInstruction, Reset);
56instruction!(OreInstruction, Update);
57instruction!(OreInstruction, Initialize);