protobook_api/
instruction.rs

1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5pub enum ProtobookInstruction {
6    Cancel = 0,
7    Close = 1,
8    Collect = 2,
9    Fill = 3,
10    Open = 4,
11    Redeem = 5,
12}
13
14#[repr(C)]
15#[derive(Clone, Copy, Debug, Pod, Zeroable)]
16pub struct Cancel {}
17
18#[repr(C)]
19#[derive(Clone, Copy, Debug, Pod, Zeroable)]
20pub struct Close {}
21
22#[repr(C)]
23#[derive(Clone, Copy, Debug, Pod, Zeroable)]
24pub struct Collect {}
25
26#[repr(C)]
27#[derive(Clone, Copy, Debug, Pod, Zeroable)]
28pub struct Expire {}
29
30#[repr(C)]
31#[derive(Clone, Copy, Debug, Pod, Zeroable)]
32pub struct Open {
33    pub amount_a: [u8; 8],
34    pub amount_b: [u8; 8],
35    pub expires_at: [u8; 8],
36    pub fee: [u8; 8],
37    pub id: [u8; 8],
38}
39
40#[repr(C)]
41#[derive(Clone, Copy, Debug, Pod, Zeroable)]
42pub struct Fill {
43    pub amount: [u8; 8],
44}
45
46#[repr(C)]
47#[derive(Clone, Copy, Debug, Pod, Zeroable)]
48pub struct Redeem {}
49
50instruction!(ProtobookInstruction, Cancel);
51instruction!(ProtobookInstruction, Close);
52instruction!(ProtobookInstruction, Collect);
53instruction!(ProtobookInstruction, Fill);
54instruction!(ProtobookInstruction, Open);
55instruction!(ProtobookInstruction, Redeem);