radix_engine/blueprints/consensus_manager/events/validator.rs
1use crate::internal_prelude::*;
2use radix_common::math::Decimal;
3
4#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
5pub struct RegisterValidatorEvent;
6
7#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
8pub struct UnregisterValidatorEvent;
9
10#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
11pub struct StakeEvent {
12 pub xrd_staked: Decimal,
13}
14
15#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
16pub struct UnstakeEvent {
17 pub stake_units: Decimal,
18}
19
20#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
21pub struct ClaimXrdEvent {
22 pub claimed_xrd: Decimal,
23}
24
25#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
26pub struct UpdateAcceptingStakeDelegationStateEvent {
27 pub accepts_delegation: bool,
28}
29
30#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
31pub struct ProtocolUpdateReadinessSignalEvent {
32 pub protocol_version_name: String,
33}
34
35#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
36pub struct ValidatorEmissionAppliedEvent {
37 /// An epoch number of the *concluded* epoch (i.e. for which this emission applies).
38 pub epoch: Epoch,
39 /// An amount of XRD in the validator's stake pool, captured *before* this emission.
40 pub starting_stake_pool_xrd: Decimal,
41 /// An amount of XRD added to the validator's stake pool from this epoch's emissions.
42 /// Note: this number represents the net emission, after any applicable reliability penalty
43 /// and validator fee have been subtracted.
44 pub stake_pool_added_xrd: Decimal,
45 /// A total supply of stake units of the validator at the moment of applying this emission.
46 /// Note: calculating `stake_pool_added_xrd / total_stake_unit_supply` gives a convenient "XRD
47 /// emitted per stake unit" factor, which may be used to easily calculate individual staker's
48 /// gains.
49 /// Note: this number is captured *before* auto-staking of the validator fee described below.
50 pub total_stake_unit_supply: Decimal,
51 /// An amount of XRD received by the validator's owner (according to the configured fee
52 /// percentage).
53 /// Note: this fee is automatically staked and placed inside the owner's stake vault (internal
54 /// to the validator).
55 /// Note: calculating `stake_pool_added_xrd + validator_fee_xrd` gives the total emission for
56 /// this validator (entirety of which goes into its stake pool XRD vault).
57 /// Note: calculating `validator_fee_xrd / (stake_pool_added_xrd + validator_fee_xrd)` gives the
58 /// validator's configured fee percentage effective during the emission period.
59 pub validator_fee_xrd: Decimal,
60 /// A number of proposals successfully made by this validator during the emission period.
61 pub proposals_made: u64,
62 /// A number of proposals missed by this validator during the emission period.
63 pub proposals_missed: u64,
64}
65
66#[derive(ScryptoSbor, ScryptoEvent, PartialEq, Eq, Debug)]
67pub struct ValidatorRewardAppliedEvent {
68 /// An epoch number of the *concluded* epoch (i.e. for which this reward applies).
69 pub epoch: Epoch,
70 /// The reward amount
71 pub amount: Decimal,
72}