Skip to main content

blockfrost_openapi/models/
epoch_param_content.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct EpochParamContent {
6    /// Epoch number
7    #[serde(rename = "epoch")]
8    pub epoch: i32,
9    /// The linear factor for the minimum fee calculation for given epoch
10    #[serde(rename = "min_fee_a")]
11    pub min_fee_a: i32,
12    /// The constant factor for the minimum fee calculation
13    #[serde(rename = "min_fee_b")]
14    pub min_fee_b: i32,
15    /// Maximum block body size in Bytes
16    #[serde(rename = "max_block_size")]
17    pub max_block_size: i32,
18    /// Maximum transaction size
19    #[serde(rename = "max_tx_size")]
20    pub max_tx_size: i32,
21    /// Maximum block header size
22    #[serde(rename = "max_block_header_size")]
23    pub max_block_header_size: i32,
24    /// The amount of a key registration deposit in Lovelaces
25    #[serde(rename = "key_deposit")]
26    pub key_deposit: String,
27    /// The amount of a pool registration deposit in Lovelaces
28    #[serde(rename = "pool_deposit")]
29    pub pool_deposit: String,
30    /// Epoch bound on pool retirement
31    #[serde(rename = "e_max")]
32    pub e_max: i32,
33    /// Desired number of pools
34    #[serde(rename = "n_opt")]
35    pub n_opt: i32,
36    /// Pool pledge influence
37    #[serde(rename = "a0")]
38    pub a0: f64,
39    /// Monetary expansion
40    #[serde(rename = "rho")]
41    pub rho: f64,
42    /// Treasury expansion
43    #[serde(rename = "tau")]
44    pub tau: f64,
45    /// Percentage of blocks produced by federated nodes
46    #[serde(rename = "decentralisation_param")]
47    pub decentralisation_param: f64,
48    /// Seed for extra entropy
49    #[serde(rename = "extra_entropy", deserialize_with = "Option::deserialize")]
50    pub extra_entropy: Option<String>,
51    /// Accepted protocol major version
52    #[serde(rename = "protocol_major_ver")]
53    pub protocol_major_ver: i32,
54    /// Accepted protocol minor version
55    #[serde(rename = "protocol_minor_ver")]
56    pub protocol_minor_ver: i32,
57    /// Minimum UTXO value. Use `coins_per_utxo_size` for Alonzo and later eras
58    #[serde(rename = "min_utxo")]
59    pub min_utxo: String,
60    /// Minimum stake cost forced on the pool
61    #[serde(rename = "min_pool_cost")]
62    pub min_pool_cost: String,
63    /// Epoch number only used once
64    #[serde(rename = "nonce")]
65    pub nonce: String,
66    /// Cost models parameters for Plutus Core scripts. Deprecated, use `cost_models_raw` instead.
67    #[serde(rename = "cost_models", deserialize_with = "Option::deserialize")]
68    pub cost_models: Option<std::collections::HashMap<String, serde_json::Value>>,
69    /// Cost models parameters for Plutus Core scripts in raw list form
70    #[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    /// The per word cost of script memory usage
73    #[serde(rename = "price_mem", deserialize_with = "Option::deserialize")]
74    pub price_mem: Option<f64>,
75    /// The cost of script execution step usage
76    #[serde(rename = "price_step", deserialize_with = "Option::deserialize")]
77    pub price_step: Option<f64>,
78    /// The maximum number of execution memory allowed to be used in a single transaction
79    #[serde(rename = "max_tx_ex_mem", deserialize_with = "Option::deserialize")]
80    pub max_tx_ex_mem: Option<String>,
81    /// The maximum number of execution steps allowed to be used in a single transaction
82    #[serde(rename = "max_tx_ex_steps", deserialize_with = "Option::deserialize")]
83    pub max_tx_ex_steps: Option<String>,
84    /// The maximum number of execution memory allowed to be used in a single block
85    #[serde(rename = "max_block_ex_mem", deserialize_with = "Option::deserialize")]
86    pub max_block_ex_mem: Option<String>,
87    /// The maximum number of execution steps allowed to be used in a single block
88    #[serde(rename = "max_block_ex_steps", deserialize_with = "Option::deserialize")]
89    pub max_block_ex_steps: Option<String>,
90    /// The maximum Val size
91    #[serde(rename = "max_val_size", deserialize_with = "Option::deserialize")]
92    pub max_val_size: Option<String>,
93    /// The percentage of the transactions fee which must be provided as collateral when including non-native scripts
94    #[serde(rename = "collateral_percent", deserialize_with = "Option::deserialize")]
95    pub collateral_percent: Option<i32>,
96    /// The maximum number of collateral inputs allowed in a transaction
97    #[serde(rename = "max_collateral_inputs", deserialize_with = "Option::deserialize")]
98    pub max_collateral_inputs: Option<i32>,
99    /// Cost per UTxO word for Alonzo. Cost per UTxO byte for Babbage and later.
100    #[serde(rename = "coins_per_utxo_size", deserialize_with = "Option::deserialize")]
101    pub coins_per_utxo_size: Option<String>,
102    /// Cost per UTxO word for Alonzo. Cost per UTxO byte for Babbage and later.
103    #[serde(rename = "coins_per_utxo_word", deserialize_with = "Option::deserialize")]
104    pub coins_per_utxo_word: Option<String>,
105    /// Pool Voting threshold for motion of no-confidence.
106    #[serde(rename = "pvt_motion_no_confidence", deserialize_with = "Option::deserialize")]
107    pub pvt_motion_no_confidence: Option<f64>,
108    /// Pool Voting threshold for new committee/threshold (normal state).
109    #[serde(rename = "pvt_committee_normal", deserialize_with = "Option::deserialize")]
110    pub pvt_committee_normal: Option<f64>,
111    /// Pool Voting threshold for new committee/threshold (state of no-confidence).
112    #[serde(rename = "pvt_committee_no_confidence", deserialize_with = "Option::deserialize")]
113    pub pvt_committee_no_confidence: Option<f64>,
114    /// Pool Voting threshold for hard-fork initiation.
115    #[serde(rename = "pvt_hard_fork_initiation", deserialize_with = "Option::deserialize")]
116    pub pvt_hard_fork_initiation: Option<f64>,
117    /// DRep Vote threshold for motion of no-confidence.
118    #[serde(rename = "dvt_motion_no_confidence", deserialize_with = "Option::deserialize")]
119    pub dvt_motion_no_confidence: Option<f64>,
120    /// DRep Vote threshold for new committee/threshold (normal state).
121    #[serde(rename = "dvt_committee_normal", deserialize_with = "Option::deserialize")]
122    pub dvt_committee_normal: Option<f64>,
123    /// DRep Vote threshold for new committee/threshold (state of no-confidence).
124    #[serde(rename = "dvt_committee_no_confidence", deserialize_with = "Option::deserialize")]
125    pub dvt_committee_no_confidence: Option<f64>,
126    /// DRep Vote threshold for update to the Constitution.
127    #[serde(rename = "dvt_update_to_constitution", deserialize_with = "Option::deserialize")]
128    pub dvt_update_to_constitution: Option<f64>,
129    /// DRep Vote threshold for hard-fork initiation.
130    #[serde(rename = "dvt_hard_fork_initiation", deserialize_with = "Option::deserialize")]
131    pub dvt_hard_fork_initiation: Option<f64>,
132    /// DRep Vote threshold for protocol parameter changes, network group.
133    #[serde(rename = "dvt_p_p_network_group", deserialize_with = "Option::deserialize")]
134    pub dvt_p_p_network_group: Option<f64>,
135    /// DRep Vote threshold for protocol parameter changes, economic group.
136    #[serde(rename = "dvt_p_p_economic_group", deserialize_with = "Option::deserialize")]
137    pub dvt_p_p_economic_group: Option<f64>,
138    /// DRep Vote threshold for protocol parameter changes, technical group.
139    #[serde(rename = "dvt_p_p_technical_group", deserialize_with = "Option::deserialize")]
140    pub dvt_p_p_technical_group: Option<f64>,
141    /// DRep Vote threshold for protocol parameter changes, governance group.
142    #[serde(rename = "dvt_p_p_gov_group", deserialize_with = "Option::deserialize")]
143    pub dvt_p_p_gov_group: Option<f64>,
144    /// DRep Vote threshold for treasury withdrawal.
145    #[serde(rename = "dvt_treasury_withdrawal", deserialize_with = "Option::deserialize")]
146    pub dvt_treasury_withdrawal: Option<f64>,
147    /// Minimal constitutional committee size.
148    #[serde(rename = "committee_min_size", deserialize_with = "Option::deserialize")]
149    pub committee_min_size: Option<String>,
150    /// Constitutional committee term limits.
151    #[serde(rename = "committee_max_term_length", deserialize_with = "Option::deserialize")]
152    pub committee_max_term_length: Option<String>,
153    /// Governance action expiration.
154    #[serde(rename = "gov_action_lifetime", deserialize_with = "Option::deserialize")]
155    pub gov_action_lifetime: Option<String>,
156    /// Governance action deposit.
157    #[serde(rename = "gov_action_deposit", deserialize_with = "Option::deserialize")]
158    pub gov_action_deposit: Option<String>,
159    /// DRep deposit amount.
160    #[serde(rename = "drep_deposit", deserialize_with = "Option::deserialize")]
161    pub drep_deposit: Option<String>,
162    /// DRep activity period.
163    #[serde(rename = "drep_activity", deserialize_with = "Option::deserialize")]
164    pub drep_activity: Option<String>,
165    /// Pool Voting threshold for security-relevant protocol parameters changes. Renamed to pvt_p_p_security_group.
166    #[serde(rename = "pvtpp_security_group", deserialize_with = "Option::deserialize")]
167    pub pvtpp_security_group: Option<f64>,
168    /// Pool Voting threshold for security-relevant protocol parameters changes.
169    #[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