entropy_api/
instruction.rs1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5pub enum EntropyInstruction {
6 Open = 0,
7 Close = 1,
8 Next = 2,
9 Reveal = 4,
10 Sample = 5,
11}
12
13#[repr(C)]
14#[derive(Clone, Copy, Debug, Pod, Zeroable)]
15pub struct Open {
16 pub id: [u8; 8],
18
19 pub commit: [u8; 32],
21
22 pub is_auto: [u8; 8],
24
25 pub samples: [u8; 8],
27
28 pub end_at: [u8; 8],
30}
31
32#[repr(C)]
33#[derive(Clone, Copy, Debug, Pod, Zeroable)]
34pub struct Close {}
35
36#[repr(C)]
37#[derive(Clone, Copy, Debug, Pod, Zeroable)]
38pub struct Next {
39 pub end_at: [u8; 8],
40}
41
42#[repr(C)]
43#[derive(Clone, Copy, Debug, Pod, Zeroable)]
44pub struct Reveal {
45 pub seed: [u8; 32],
46}
47
48#[repr(C)]
49#[derive(Clone, Copy, Debug, Pod, Zeroable)]
50pub struct Sample {}
51
52instruction!(EntropyInstruction, Open);
53instruction!(EntropyInstruction, Close);
54instruction!(EntropyInstruction, Next);
55instruction!(EntropyInstruction, Reveal);
56instruction!(EntropyInstruction, Sample);