coal_guilds_api/
instruction.rs1use steel::*;
2
3#[repr(u8)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
5#[rustfmt::skip]
6pub enum GuildInstruction {
7 Join = 100,
9 Leave = 101,
10 Stake = 102,
11 Unstake = 103,
12 Delegate = 107,
13 NewMember = 104,
15 NewGuild = 105,
16 NewInvite = 106,
17 Initialize = 200,
19}
20
21impl GuildInstruction {
22 pub fn to_vec(&self) -> Vec<u8> {
23 vec![*self as u8]
24 }
25}
26
27#[repr(C)]
28#[derive(Clone, Copy, Debug, Pod, Zeroable)]
29pub struct Initialize {
30 pub config_bump: u8,
31}
32
33#[repr(C)]
34#[derive(Clone, Copy, Debug, Pod, Zeroable)]
35pub struct NewGuild {
36 pub guild_bump: u8,
37}
38
39#[repr(C)]
40#[derive(Clone, Copy, Debug, Pod, Zeroable)]
41pub struct NewMember {
42 pub member_bump: u8,
43}
44
45#[repr(C)]
46#[derive(Clone, Copy, Debug, Pod, Zeroable)]
47pub struct NewInvite {
48 pub invite_bump: u8,
49 pub guild_bump: u8,
50}
51
52#[repr(C)]
53#[derive(Clone, Copy, Debug, Pod, Zeroable)]
54pub struct Join {
55 pub invite_bump: u8,
56 pub member_bump: u8,
57}
58
59#[repr(C)]
60#[derive(Clone, Copy, Debug, Pod, Zeroable)]
61pub struct Delegate {
62 pub member_bump: u8,
63}
64
65#[repr(C)]
66#[derive(Clone, Copy, Debug, Pod, Zeroable)]
67pub struct Leave {}
68
69#[repr(C)]
70#[derive(Clone, Copy, Debug, Pod, Zeroable)]
71pub struct Stake {
72 pub amount: [u8; 8],
73}
74
75#[repr(C)]
76#[derive(Clone, Copy, Debug, Pod, Zeroable)]
77pub struct Unstake {
78 pub amount: [u8; 8],
79}
80
81instruction!(GuildInstruction, Initialize);
82instruction!(GuildInstruction, Delegate);
83instruction!(GuildInstruction, NewGuild);
84instruction!(GuildInstruction, NewMember);
85instruction!(GuildInstruction, NewInvite);
86instruction!(GuildInstruction, Join);
87instruction!(GuildInstruction, Leave);
88instruction!(GuildInstruction, Stake);
89instruction!(GuildInstruction, Unstake);