1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct EpochParamContent {
6 #[serde(rename = "epoch")]
8 pub epoch: i32,
9 #[serde(rename = "min_fee_a")]
11 pub min_fee_a: i32,
12 #[serde(rename = "min_fee_b")]
14 pub min_fee_b: i32,
15 #[serde(rename = "max_block_size")]
17 pub max_block_size: i32,
18 #[serde(rename = "max_tx_size")]
20 pub max_tx_size: i32,
21 #[serde(rename = "max_block_header_size")]
23 pub max_block_header_size: i32,
24 #[serde(rename = "key_deposit")]
26 pub key_deposit: String,
27 #[serde(rename = "pool_deposit")]
29 pub pool_deposit: String,
30 #[serde(rename = "e_max")]
32 pub e_max: i32,
33 #[serde(rename = "n_opt")]
35 pub n_opt: i32,
36 #[serde(rename = "a0")]
38 pub a0: f64,
39 #[serde(rename = "rho")]
41 pub rho: f64,
42 #[serde(rename = "tau")]
44 pub tau: f64,
45 #[serde(rename = "decentralisation_param")]
47 pub decentralisation_param: f64,
48 #[serde(rename = "extra_entropy", deserialize_with = "Option::deserialize")]
50 pub extra_entropy: Option<String>,
51 #[serde(rename = "protocol_major_ver")]
53 pub protocol_major_ver: i32,
54 #[serde(rename = "protocol_minor_ver")]
56 pub protocol_minor_ver: i32,
57 #[serde(rename = "min_utxo")]
59 pub min_utxo: String,
60 #[serde(rename = "min_pool_cost")]
62 pub min_pool_cost: String,
63 #[serde(rename = "nonce")]
65 pub nonce: String,
66 #[serde(rename = "cost_models", deserialize_with = "Option::deserialize")]
68 pub cost_models: Option<std::collections::HashMap<String, serde_json::Value>>,
69 #[serde(rename = "cost_models_raw", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
71 pub cost_models_raw: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
72 #[serde(rename = "price_mem", deserialize_with = "Option::deserialize")]
74 pub price_mem: Option<f64>,
75 #[serde(rename = "price_step", deserialize_with = "Option::deserialize")]
77 pub price_step: Option<f64>,
78 #[serde(rename = "max_tx_ex_mem", deserialize_with = "Option::deserialize")]
80 pub max_tx_ex_mem: Option<String>,
81 #[serde(rename = "max_tx_ex_steps", deserialize_with = "Option::deserialize")]
83 pub max_tx_ex_steps: Option<String>,
84 #[serde(rename = "max_block_ex_mem", deserialize_with = "Option::deserialize")]
86 pub max_block_ex_mem: Option<String>,
87 #[serde(rename = "max_block_ex_steps", deserialize_with = "Option::deserialize")]
89 pub max_block_ex_steps: Option<String>,
90 #[serde(rename = "max_val_size", deserialize_with = "Option::deserialize")]
92 pub max_val_size: Option<String>,
93 #[serde(rename = "collateral_percent", deserialize_with = "Option::deserialize")]
95 pub collateral_percent: Option<i32>,
96 #[serde(rename = "max_collateral_inputs", deserialize_with = "Option::deserialize")]
98 pub max_collateral_inputs: Option<i32>,
99 #[serde(rename = "coins_per_utxo_size", deserialize_with = "Option::deserialize")]
101 pub coins_per_utxo_size: Option<String>,
102 #[serde(rename = "coins_per_utxo_word", deserialize_with = "Option::deserialize")]
104 pub coins_per_utxo_word: Option<String>,
105 #[serde(rename = "pvt_motion_no_confidence", deserialize_with = "Option::deserialize")]
107 pub pvt_motion_no_confidence: Option<f64>,
108 #[serde(rename = "pvt_committee_normal", deserialize_with = "Option::deserialize")]
110 pub pvt_committee_normal: Option<f64>,
111 #[serde(rename = "pvt_committee_no_confidence", deserialize_with = "Option::deserialize")]
113 pub pvt_committee_no_confidence: Option<f64>,
114 #[serde(rename = "pvt_hard_fork_initiation", deserialize_with = "Option::deserialize")]
116 pub pvt_hard_fork_initiation: Option<f64>,
117 #[serde(rename = "dvt_motion_no_confidence", deserialize_with = "Option::deserialize")]
119 pub dvt_motion_no_confidence: Option<f64>,
120 #[serde(rename = "dvt_committee_normal", deserialize_with = "Option::deserialize")]
122 pub dvt_committee_normal: Option<f64>,
123 #[serde(rename = "dvt_committee_no_confidence", deserialize_with = "Option::deserialize")]
125 pub dvt_committee_no_confidence: Option<f64>,
126 #[serde(rename = "dvt_update_to_constitution", deserialize_with = "Option::deserialize")]
128 pub dvt_update_to_constitution: Option<f64>,
129 #[serde(rename = "dvt_hard_fork_initiation", deserialize_with = "Option::deserialize")]
131 pub dvt_hard_fork_initiation: Option<f64>,
132 #[serde(rename = "dvt_p_p_network_group", deserialize_with = "Option::deserialize")]
134 pub dvt_p_p_network_group: Option<f64>,
135 #[serde(rename = "dvt_p_p_economic_group", deserialize_with = "Option::deserialize")]
137 pub dvt_p_p_economic_group: Option<f64>,
138 #[serde(rename = "dvt_p_p_technical_group", deserialize_with = "Option::deserialize")]
140 pub dvt_p_p_technical_group: Option<f64>,
141 #[serde(rename = "dvt_p_p_gov_group", deserialize_with = "Option::deserialize")]
143 pub dvt_p_p_gov_group: Option<f64>,
144 #[serde(rename = "dvt_treasury_withdrawal", deserialize_with = "Option::deserialize")]
146 pub dvt_treasury_withdrawal: Option<f64>,
147 #[serde(rename = "committee_min_size", deserialize_with = "Option::deserialize")]
149 pub committee_min_size: Option<String>,
150 #[serde(rename = "committee_max_term_length", deserialize_with = "Option::deserialize")]
152 pub committee_max_term_length: Option<String>,
153 #[serde(rename = "gov_action_lifetime", deserialize_with = "Option::deserialize")]
155 pub gov_action_lifetime: Option<String>,
156 #[serde(rename = "gov_action_deposit", deserialize_with = "Option::deserialize")]
158 pub gov_action_deposit: Option<String>,
159 #[serde(rename = "drep_deposit", deserialize_with = "Option::deserialize")]
161 pub drep_deposit: Option<String>,
162 #[serde(rename = "drep_activity", deserialize_with = "Option::deserialize")]
164 pub drep_activity: Option<String>,
165 #[serde(rename = "pvtpp_security_group", deserialize_with = "Option::deserialize")]
167 pub pvtpp_security_group: Option<f64>,
168 #[serde(rename = "pvt_p_p_security_group", deserialize_with = "Option::deserialize")]
170 pub pvt_p_p_security_group: Option<f64>,
171 #[serde(rename = "min_fee_ref_script_cost_per_byte", deserialize_with = "Option::deserialize")]
172 pub min_fee_ref_script_cost_per_byte: Option<f64>,
173}
174
175impl EpochParamContent {
176 pub fn new(epoch: i32, min_fee_a: i32, min_fee_b: i32, max_block_size: i32, max_tx_size: i32, max_block_header_size: i32, key_deposit: String, pool_deposit: String, e_max: i32, n_opt: i32, a0: f64, rho: f64, tau: f64, decentralisation_param: f64, extra_entropy: Option<String>, protocol_major_ver: i32, protocol_minor_ver: i32, min_utxo: String, min_pool_cost: String, nonce: String, cost_models: Option<std::collections::HashMap<String, serde_json::Value>>, price_mem: Option<f64>, price_step: Option<f64>, max_tx_ex_mem: Option<String>, max_tx_ex_steps: Option<String>, max_block_ex_mem: Option<String>, max_block_ex_steps: Option<String>, max_val_size: Option<String>, collateral_percent: Option<i32>, max_collateral_inputs: Option<i32>, coins_per_utxo_size: Option<String>, coins_per_utxo_word: Option<String>, pvt_motion_no_confidence: Option<f64>, pvt_committee_normal: Option<f64>, pvt_committee_no_confidence: Option<f64>, pvt_hard_fork_initiation: Option<f64>, dvt_motion_no_confidence: Option<f64>, dvt_committee_normal: Option<f64>, dvt_committee_no_confidence: Option<f64>, dvt_update_to_constitution: Option<f64>, dvt_hard_fork_initiation: Option<f64>, dvt_p_p_network_group: Option<f64>, dvt_p_p_economic_group: Option<f64>, dvt_p_p_technical_group: Option<f64>, dvt_p_p_gov_group: Option<f64>, dvt_treasury_withdrawal: Option<f64>, committee_min_size: Option<String>, committee_max_term_length: Option<String>, gov_action_lifetime: Option<String>, gov_action_deposit: Option<String>, drep_deposit: Option<String>, drep_activity: Option<String>, pvtpp_security_group: Option<f64>, pvt_p_p_security_group: Option<f64>, min_fee_ref_script_cost_per_byte: Option<f64>) -> EpochParamContent {
177 EpochParamContent {
178 epoch,
179 min_fee_a,
180 min_fee_b,
181 max_block_size,
182 max_tx_size,
183 max_block_header_size,
184 key_deposit,
185 pool_deposit,
186 e_max,
187 n_opt,
188 a0,
189 rho,
190 tau,
191 decentralisation_param,
192 extra_entropy,
193 protocol_major_ver,
194 protocol_minor_ver,
195 min_utxo,
196 min_pool_cost,
197 nonce,
198 cost_models,
199 cost_models_raw: None,
200 price_mem,
201 price_step,
202 max_tx_ex_mem,
203 max_tx_ex_steps,
204 max_block_ex_mem,
205 max_block_ex_steps,
206 max_val_size,
207 collateral_percent,
208 max_collateral_inputs,
209 coins_per_utxo_size,
210 coins_per_utxo_word,
211 pvt_motion_no_confidence,
212 pvt_committee_normal,
213 pvt_committee_no_confidence,
214 pvt_hard_fork_initiation,
215 dvt_motion_no_confidence,
216 dvt_committee_normal,
217 dvt_committee_no_confidence,
218 dvt_update_to_constitution,
219 dvt_hard_fork_initiation,
220 dvt_p_p_network_group,
221 dvt_p_p_economic_group,
222 dvt_p_p_technical_group,
223 dvt_p_p_gov_group,
224 dvt_treasury_withdrawal,
225 committee_min_size,
226 committee_max_term_length,
227 gov_action_lifetime,
228 gov_action_deposit,
229 drep_deposit,
230 drep_activity,
231 pvtpp_security_group,
232 pvt_p_p_security_group,
233 min_fee_ref_script_cost_per_byte,
234 }
235 }
236}
237