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(any(feature = "nns-host", feature = "canister"))]
9use ic_platform::candid::contract::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(any(feature = "nns-host", feature = "canister"), derive(CandidType))]
34#[cfg_attr(
35    any(feature = "nns-host", feature = "canister"),
36    candid_path("ic_platform::candid::contract")
37)]
38#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
39pub struct NnsGovernanceRewardEvent {
40    /// Rounds elapsed since the previous distribution when supplied.
41    pub rounds_since_last_distribution: Option<u64>,
42    /// Reward day after NNS genesis.
43    pub day_after_genesis: u64,
44    /// Actual reward-event timestamp in Unix seconds.
45    pub actual_timestamp_seconds: u64,
46    /// Total rewards available in e8s-equivalent.
47    pub total_available_e8s_equivalent: u64,
48    /// Rewards available in the latest round when supplied.
49    pub latest_round_available_e8s_equivalent: Option<u64>,
50    /// Rewards distributed in e8s-equivalent.
51    pub distributed_e8s_equivalent: u64,
52    /// Proposals settled by the event, in Governance order.
53    pub settled_proposals: Vec<NnsGovernanceProposalId>,
54}
55
56///
57/// NnsGovernanceProposalId
58///
59/// Native NNS Governance proposal identifier wrapper.
60///
61
62#[cfg_attr(any(feature = "nns-host", feature = "canister"), derive(CandidType))]
63#[cfg_attr(
64    any(feature = "nns-host", feature = "canister"),
65    candid_path("ic_platform::candid::contract")
66)]
67#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
68pub struct NnsGovernanceProposalId {
69    /// Governance proposal identifier.
70    pub id: u64,
71}
72
73///
74/// NnsGovernanceMaturityModulationReport
75///
76/// Serializable live snapshot of NNS maturity modulation.
77///
78
79#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
80pub struct NnsGovernanceMaturityModulationReport {
81    /// Shared Governance query provenance.
82    #[serde(flatten)]
83    pub context: NnsGovernanceReportContext,
84    /// Current modulation when Governance supplies it.
85    pub maturity_modulation: Option<NnsGovernanceMaturityModulation>,
86}
87
88///
89/// NnsGovernanceMaturityModulation
90///
91/// Current native NNS Governance maturity-modulation value.
92///
93
94#[cfg_attr(any(feature = "nns-host", feature = "canister"), derive(CandidType))]
95#[cfg_attr(
96    any(feature = "nns-host", feature = "canister"),
97    candid_path("ic_platform::candid::contract")
98)]
99#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
100pub struct NnsGovernanceMaturityModulation {
101    /// Current signed modulation in permyriad when supplied.
102    pub current_value_permyriad: Option<i32>,
103    /// Last update timestamp in Unix seconds when supplied.
104    pub updated_at_timestamp_seconds: Option<u64>,
105}