Skip to main content

ic_query/sns/report/model/reports/neurons/
row.rs

1//! Module: sns::report::model::reports::neurons::row
2//!
3//! Responsibility: SNS neuron row DTO.
4//! Does not own: governance wire conversion, row ordering, or rendering.
5//! Boundary: preserves raw neuron fields used by live reports and snapshots.
6
7use serde::{Deserialize as SerdeDeserialize, Serialize};
8
9///
10/// SnsNeuronDissolveState
11///
12/// Raw dissolve-state alternative returned by SNS governance.
13///
14
15#[derive(Clone, Copy, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
16#[serde(rename_all = "snake_case", tag = "kind", content = "value")]
17pub enum SnsNeuronDissolveState {
18    /// Remaining dissolve delay in seconds.
19    DissolveDelaySeconds(u64),
20    /// Unix timestamp in seconds at which the neuron is dissolved.
21    WhenDissolvedTimestampSeconds(u64),
22}
23
24///
25/// SnsNeuronRow
26///
27/// Serializable row for one SNS neuron in live reports and cached snapshots.
28///
29
30#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
31#[serde(deny_unknown_fields)]
32pub struct SnsNeuronRow {
33    /// Lowercase hexadecimal SNS neuron identifier.
34    pub neuron_id: String,
35    /// Cached neuron stake in e8s.
36    pub cached_neuron_stake_e8s: u64,
37    /// Unstaked maturity in e8s-equivalent units.
38    pub maturity_e8s_equivalent: u64,
39    /// Staked maturity in e8s-equivalent units when present.
40    pub staked_maturity_e8s_equivalent: Option<u64>,
41    /// Unix timestamp in seconds at which the neuron was created.
42    pub created_timestamp_seconds: u64,
43    /// UTC rendering derived exactly from `created_timestamp_seconds`.
44    pub created_at: String,
45    /// Source NNS neuron identifier when the neuron was created from one.
46    pub source_nns_neuron_id: Option<u64>,
47    /// Whether maturity is automatically staked when governance supplies the setting.
48    pub auto_stake_maturity: Option<bool>,
49    /// Raw SNS governance aging timestamp in seconds.
50    pub aging_since_timestamp_seconds: u64,
51    /// Raw SNS governance dissolve-state alternative.
52    pub dissolve_state: Option<SnsNeuronDissolveState>,
53    /// Raw voting-power percentage multiplier.
54    pub voting_power_percentage_multiplier: u64,
55    /// Vesting period in seconds when present.
56    pub vesting_period_seconds: Option<u64>,
57    /// Accumulated neuron fees in e8s.
58    pub neuron_fees_e8s: u64,
59}