ore_stake_api/event.rs
1use serde::{Deserialize, Serialize};
2use steel::*;
3
4pub enum OreEvent {
5 Reset = 0,
6 Bury = 1,
7 Deploy = 2,
8 Liq = 3,
9 Claim = 4,
10}
11
12#[repr(C)]
13#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
14pub struct ResetEvent {
15 /// The event discriminator.
16 pub disc: u64,
17
18 /// The block that was opened for trading.
19 pub round_id: u64,
20
21 /// The start slot of the next block.
22 pub start_slot: u64,
23
24 /// The end slot of the next block.
25 pub end_slot: u64,
26
27 /// The winning square of the round.
28 pub winning_square: u64,
29
30 /// The top miner of the round.
31 pub top_miner: Pubkey,
32
33 /// The number of miners on the winning square.
34 pub num_winners: u64,
35
36 /// The amount of ORE payout for the motherlode.
37 pub motherlode: u64,
38
39 /// The total amount of SOL prospected in the round.
40 pub total_deployed: u64,
41
42 /// The total amount of SOL put in the ORE vault.
43 pub total_vaulted: u64,
44
45 /// The total amount of SOL won by miners for the round.
46 pub total_winnings: u64,
47
48 /// The total amount of ORE minted for the round.
49 pub total_minted: u64,
50
51 /// The timestamp of the event.
52 pub ts: i64,
53
54 /// The rng value of the round.
55 pub rng: u64,
56
57 /// The amount deployed on the winning square.
58 pub deployed_winning_square: u64,
59}
60
61#[repr(C)]
62#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
63pub struct BuryEvent {
64 /// The event discriminator.
65 pub disc: u64,
66
67 /// The amount of ORE buried.
68 pub ore_buried: u64,
69
70 /// The amount of ORE shared with stakers.
71 pub ore_shared: u64,
72
73 /// The amount of SOL swapped.
74 pub sol_amount: u64,
75
76 /// The new circulating supply of ORE.
77 pub new_circulating_supply: u64,
78
79 /// The timestamp of the event.
80 pub ts: i64,
81}
82
83#[repr(C)]
84#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
85pub struct DeployEvent {
86 /// The event discriminator.
87 pub disc: u64,
88
89 /// The authority of the deployer.
90 pub authority: Pubkey,
91
92 /// The amount of SOL deployed per square.
93 pub amount: u64,
94
95 /// The mask of the squares deployed to.
96 pub mask: u64,
97
98 /// The round id.
99 pub round_id: u64,
100
101 /// The signer of the deployer.
102 pub signer: Pubkey,
103
104 /// The strategy used by the autominer (u64::MAX if manual).
105 pub strategy: u64,
106
107 /// The total number of squares deployed to.
108 pub total_squares: u64,
109
110 /// The timestamp of the event.
111 pub ts: i64,
112}
113
114#[repr(C)]
115#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
116pub struct LiqEvent {
117 /// The event discriminator.
118 pub disc: u64,
119
120 /// The amount of SOL sent to the liq manager.
121 pub sol_amount: u64,
122
123 /// The recipient of the SOL.
124 pub recipient: Pubkey,
125
126 /// The timestamp of the event.
127 pub ts: i64,
128}
129
130/// Claim event - emitted when a miner claims SOL or ORE rewards.
131#[repr(C)]
132#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
133pub struct ClaimEvent {
134 /// The event discriminator.
135 pub disc: u64,
136
137 /// The authority of the miner claiming.
138 pub authority: Pubkey,
139
140 /// The amount claimed.
141 pub amount: u64,
142
143 /// The claim type (0 = SOL, 1 = ORE).
144 pub claim_type: u64,
145
146 /// The timestamp of the event.
147 pub ts: i64,
148}
149
150event!(ResetEvent);
151event!(BuryEvent);
152event!(DeployEvent);
153event!(LiqEvent);
154event!(ClaimEvent);