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    #[deprecated(since = "0.1.4", note = "Fee no longer supported")]
37    pub fee: [u8; 8],
38    pub id: [u8; 8],
39}
40
41#[repr(C)]
42#[derive(Clone, Copy, Debug, Pod, Zeroable)]
43pub struct Fill {
44    pub amount: [u8; 8],
45}
46
47#[repr(C)]
48#[derive(Clone, Copy, Debug, Pod, Zeroable)]
49pub struct Redeem {}
50
51instruction!(ProtobookInstruction, Cancel);
52instruction!(ProtobookInstruction, Close);
53instruction!(ProtobookInstruction, Collect);
54instruction!(ProtobookInstruction, Fill);
55instruction!(ProtobookInstruction, Open);
56instruction!(ProtobookInstruction, Redeem);