Skip to main content

ore_stake_api/
event.rs

1use serde::{Deserialize, Serialize};
2use steel::*;
3
4pub enum OreStakeEvent {
5    Claim = 0,
6    Deposit = 1,
7    Distribute = 2,
8    Withdraw = 3,
9    Compound = 4,
10}
11
12#[repr(C)]
13#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
14pub struct ClaimEvent {
15    /// The event discriminator.
16    pub disc: u64,
17
18    /// The authority of the staker claiming.
19    pub authority: Pubkey,
20
21    /// The amount of ORE claimed.
22    pub amount: u64,
23
24    /// The timestamp of the event.
25    pub ts: i64,
26}
27
28#[repr(C)]
29#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
30pub struct DepositEvent {
31    /// The event discriminator.
32    pub disc: u64,
33
34    /// The authority of the staker depositing.
35    pub authority: Pubkey,
36
37    /// The amount of ORE deposited.
38    pub amount: u64,
39
40    /// The timestamp of the event.
41    pub ts: i64,
42}
43
44#[repr(C)]
45#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
46pub struct DistributeEvent {
47    /// The event discriminator.
48    pub disc: u64,
49
50    /// The amount of ORE distributed to stakers.
51    pub amount: u64,
52
53    /// The total amount of ORE staked at the time of distribution.
54    pub total_staked: u64,
55
56    /// The timestamp of the event.
57    pub ts: i64,
58}
59
60#[repr(C)]
61#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
62pub struct WithdrawEvent {
63    /// The event discriminator.
64    pub disc: u64,
65
66    /// The authority of the staker withdrawing.
67    pub authority: Pubkey,
68
69    /// The amount of ORE withdrawn.
70    pub amount: u64,
71
72    /// The timestamp of the event.
73    pub ts: i64,
74}
75
76#[repr(C)]
77#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
78pub struct CompoundEvent {
79    /// The event discriminator.
80    pub disc: u64,
81
82    /// The authority of the stake account being compounded.
83    pub authority: Pubkey,
84
85    /// The amount of ORE compounded.
86    pub amount: u64,
87
88    /// The timestamp of the event.
89    pub ts: i64,
90}
91
92event!(ClaimEvent);
93event!(CompoundEvent);
94event!(DepositEvent);
95event!(DistributeEvent);
96event!(WithdrawEvent);