Skip to main content

ic_query/nns/governance/model/
events.rs

1//! Module: nns::governance::model::events
2//!
3//! Responsibility: native NNS Governance reward-event and maturity-modulation contracts.
4//! Does not own: economics, metrics, transport, caching, or rendering.
5//! Boundary: preserves the two bounded Governance point-value response families.
6
7use super::NnsGovernanceReportContext;
8#[cfg(feature = "host")]
9use candid::CandidType;
10use serde::{Deserialize as SerdeDeserialize, Serialize};
11
12///
13/// NnsGovernanceRewardEventReport
14///
15/// Serializable live snapshot of the latest NNS voting reward event.
16///
17
18#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
19pub struct NnsGovernanceRewardEventReport {
20    /// Shared Governance query provenance.
21    #[serde(flatten)]
22    pub context: NnsGovernanceReportContext,
23    /// Latest native Governance reward event.
24    pub reward_event: NnsGovernanceRewardEvent,
25}
26
27///
28/// NnsGovernanceRewardEvent
29///
30/// Latest native NNS Governance voting reward event.
31///
32
33#[cfg_attr(feature = "host", derive(CandidType))]
34#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
35pub struct NnsGovernanceRewardEvent {
36    /// Rounds elapsed since the previous distribution when supplied.
37    pub rounds_since_last_distribution: Option<u64>,
38    /// Reward day after NNS genesis.
39    pub day_after_genesis: u64,
40    /// Actual reward-event timestamp in Unix seconds.
41    pub actual_timestamp_seconds: u64,
42    /// Total rewards available in e8s-equivalent.
43    pub total_available_e8s_equivalent: u64,
44    /// Rewards available in the latest round when supplied.
45    pub latest_round_available_e8s_equivalent: Option<u64>,
46    /// Rewards distributed in e8s-equivalent.
47    pub distributed_e8s_equivalent: u64,
48    /// Proposals settled by the event, in Governance order.
49    pub settled_proposals: Vec<NnsGovernanceProposalId>,
50}
51
52///
53/// NnsGovernanceProposalId
54///
55/// Native NNS Governance proposal identifier wrapper.
56///
57
58#[cfg_attr(feature = "host", derive(CandidType))]
59#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
60pub struct NnsGovernanceProposalId {
61    /// Governance proposal identifier.
62    pub id: u64,
63}
64
65///
66/// NnsGovernanceMaturityModulationReport
67///
68/// Serializable live snapshot of NNS maturity modulation.
69///
70
71#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
72pub struct NnsGovernanceMaturityModulationReport {
73    /// Shared Governance query provenance.
74    #[serde(flatten)]
75    pub context: NnsGovernanceReportContext,
76    /// Current modulation when Governance supplies it.
77    pub maturity_modulation: Option<NnsGovernanceMaturityModulation>,
78}
79
80///
81/// NnsGovernanceMaturityModulation
82///
83/// Current native NNS Governance maturity-modulation value.
84///
85
86#[cfg_attr(feature = "host", derive(CandidType))]
87#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
88pub struct NnsGovernanceMaturityModulation {
89    /// Current signed modulation in permyriad when supplied.
90    pub current_value_permyriad: Option<i32>,
91    /// Last update timestamp in Unix seconds when supplied.
92    pub updated_at_timestamp_seconds: Option<u64>,
93}