1use serde::{Deserialize, Serialize};
2
3use super::ProposalType;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Tip {
7 pub hash: String,
8 pub epoch_no: u64,
9 pub abs_slot: u64,
10 pub epoch_slot: u64,
11 pub block_no: u64,
12 pub block_time: u64,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct Genesis {
17 pub networkmagic: String,
18 pub networkid: String,
19 pub epochlength: String,
20 pub slotlength: String,
21 pub maxlovelacesupply: String,
22 pub systemstart: u64,
23 pub activeslotcoeff: String,
24 pub slotsperkesperiod: String,
25 pub maxkesrevolutions: String,
26 pub securityparam: String,
27 pub updatequorum: String,
28 pub alonzogenesis: String,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
32pub struct Totals {
33 pub epoch_no: u64,
34 pub circulation: String,
35 pub treasury: String,
36 pub reward: String,
37 pub supply: String,
38 pub reserves: String,
39 pub fees: String,
40 pub deposits_stake: String,
41 pub deposits_drep: String,
42 pub deposits_proposal: String,
43}
44
45#[derive(Debug, Clone, Serialize, Copy, Deserialize)]
46pub struct CliProtocolParams {
47 pub collateral_percentage: u64,
48 pub max_block_body_size: u64,
49 pub max_block_header_size: u64,
50 pub max_collateral_inputs: u64,
51 pub max_tx_size: u64,
52 pub max_value_size: u64,
53 pub min_pool_cost: u64,
54 #[serde(skip_serializing_if = "Option::is_none")]
55 pub min_utxo_value: Option<u64>,
56 pub monetary_expansion: f64,
57 pub pool_pledge_influence: f64,
58 pub pool_retire_max_epoch: u64,
59 pub protocol_version: ProtocolVersion,
60 pub stake_address_deposit: u64,
61 pub stake_pool_deposit: u64,
62 pub stake_pool_target_num: u64,
63 pub treasury_cut: f64,
64 pub tx_fee_fixed: u64,
65 pub tx_fee_per_byte: u64,
66 pub utxo_cost_per_byte: u64,
67}
68
69#[derive(Debug, Clone, Serialize, Copy, Deserialize)]
70pub struct ProtocolVersion {
71 pub major: u64,
72 pub minor: u64,
73}
74
75impl Tip {
77 pub fn new(
78 hash: String,
79 epoch_no: u64,
80 abs_slot: u64,
81 epoch_slot: u64,
82 block_no: u64,
83 block_time: u64,
84 ) -> Self {
85 Self {
86 hash,
87 epoch_no,
88 abs_slot,
89 epoch_slot,
90 block_no,
91 block_time,
92 }
93 }
94}
95
96impl Genesis {
97 pub fn new(
98 networkmagic: String,
99 networkid: String,
100 epochlength: String,
101 slotlength: String,
102 maxlovelacesupply: String,
103 systemstart: u64,
104 activeslotcoeff: String,
105 slotsperkesperiod: String,
106 maxkesrevolutions: String,
107 securityparam: String,
108 updatequorum: String,
109 alonzogenesis: String,
110 ) -> Self {
111 Self {
112 networkmagic,
113 networkid,
114 epochlength,
115 slotlength,
116 maxlovelacesupply,
117 systemstart,
118 activeslotcoeff,
119 slotsperkesperiod,
120 maxkesrevolutions,
121 securityparam,
122 updatequorum,
123 alonzogenesis,
124 }
125 }
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
129pub struct ReserveWithdrawal {
130 pub epoch_no: u64,
131 pub epoch_slot: u64,
132 pub tx_hash: String,
133 pub block_hash: String,
134 pub block_height: u64,
135 pub amount: String,
136 pub stake_address: String,
137 pub earned_epoch: u64,
138 pub spendable_epoch: u64,
139}
140
141#[derive(Debug, Clone, Serialize, Deserialize)]
142pub struct ParamUpdate {
143 pub tx_hash: String,
144 pub block_height: u64,
145 pub block_time: u64,
146 pub epoch_no: u64,
147 pub data: String,
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize, Default)]
151pub struct OgmiosTip {
152 pub jsonrpc: String,
153 pub method: String,
154 #[serde(default)] pub result: OgmiosTipResult,
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize, Default)]
159pub struct OgmiosTipResult {
160 pub slot: u64,
161 pub id: String,
162}
163
164impl OgmiosTip {
165 pub fn new(slot: u64, id: String) -> Self {
166 Self {
167 jsonrpc: "2.0".to_string(),
168 method: "queryNetwork/tip".to_string(),
169 result: OgmiosTipResult { slot, id },
170 }
171 }
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
175pub struct ProposalVotingSummary {
176 pub proposal_type: ProposalType,
177 pub epoch_no: u64,
178 pub drep_yes_votes_cast: u64,
179 pub drep_active_yes_vote_power: u64,
180 pub drep_yes_vote_power: u64,
181 pub drep_yes_pct: f64,
182 pub drep_no_votes_cast: u64,
183 pub drep_active_no_vote_power: u64,
184 pub drep_no_vote_power: u64,
185 pub drep_no_pct: f64,
186 pub drep_abstain_votes_cast: u64,
187 pub drep_active_abstain_vote_power: u64,
188 pub drep_always_no_confidence_vote_power: u64,
189 pub drep_always_abstain_vote_power: u64,
190 pub pool_yes_votes_cast: u64,
191 pub pool_active_yes_vote_power: u64,
192 pub pool_yes_vote_power: u64,
193 pub pool_yes_pct: f64,
194 pub pool_no_votes_cast: u64,
195 pub pool_active_no_vote_power: u64,
196 pub pool_no_vote_power: u64,
197 pub pool_no_pct: f64,
198 pub pool_abstain_votes_cast: u64,
199 pub pool_active_abstain_vote_power: u64,
200 pub pool_passive_always_abstain_votes_assigned: u64,
201 pub pool_passive_always_abstain_vote_power: u64,
202 pub pool_passive_always_no_confidence_votes_assigned: u64,
203 pub pool_passive_always_no_confidence_vote_power: u64,
204 pub committee_yes_votes_cast: u64,
205 pub committee_yes_pct: f64,
206 pub committee_no_votes_cast: u64,
207 pub committee_no_pct: f64,
208 pub committee_abstain_votes_cast: u64,
209}