1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use super::Hnt;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Validator {
pub address: String,
pub owner: String,
#[serde(deserialize_with = "Hnt::deserialize")]
pub stake: Hnt,
pub last_heartbeat: u64,
pub version_heartbeat: u64,
pub stake_status: String,
pub penalty: f64,
pub penalties: Vec<Penalty>,
pub block_added: u64,
pub block: u64,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct ValidatorStats {
pub active: Option<u64>,
pub staked: StakeStats,
pub unstaked: StakeStats,
pub cooldown: StakeStats,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Reward {
pub account: String,
#[serde(deserialize_with = "Hnt::deserialize")]
pub amount: Hnt,
pub block: i64,
pub gateway: String,
pub hash: String,
pub timestamp: DateTime<Utc>,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct StakeStats {
#[serde(deserialize_with = "Hnt::deserialize")]
pub amount: Hnt,
pub count: u64,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum PenaltyType {
Performance,
Tenure,
Dkg,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Penalty {
#[serde(rename = "type")]
pub kind: PenaltyType,
pub height: u64,
pub amount: f64,
}