blockfrost_openapi/models/
proposal.rs1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct Proposal {
6 #[serde(rename = "id")]
8 pub id: String,
9 #[serde(rename = "tx_hash")]
11 pub tx_hash: String,
12 #[serde(rename = "cert_index")]
14 pub cert_index: i32,
15 #[serde(rename = "governance_type")]
17 pub governance_type: GovernanceType,
18 #[serde(rename = "governance_description", deserialize_with = "Option::deserialize")]
20 pub governance_description: Option<std::collections::HashMap<String, serde_json::Value>>,
21 #[serde(rename = "deposit")]
23 pub deposit: String,
24 #[serde(rename = "return_address")]
26 pub return_address: String,
27 #[serde(rename = "ratified_epoch", deserialize_with = "Option::deserialize")]
29 pub ratified_epoch: Option<i32>,
30 #[serde(rename = "enacted_epoch", deserialize_with = "Option::deserialize")]
32 pub enacted_epoch: Option<i32>,
33 #[serde(rename = "dropped_epoch", deserialize_with = "Option::deserialize")]
35 pub dropped_epoch: Option<i32>,
36 #[serde(rename = "expired_epoch", deserialize_with = "Option::deserialize")]
38 pub expired_epoch: Option<i32>,
39 #[serde(rename = "expiration")]
41 pub expiration: i32,
42}
43
44impl Proposal {
45 pub fn new(id: String, tx_hash: String, cert_index: i32, governance_type: GovernanceType, governance_description: Option<std::collections::HashMap<String, serde_json::Value>>, deposit: String, return_address: String, ratified_epoch: Option<i32>, enacted_epoch: Option<i32>, dropped_epoch: Option<i32>, expired_epoch: Option<i32>, expiration: i32) -> Proposal {
46 Proposal {
47 id,
48 tx_hash,
49 cert_index,
50 governance_type,
51 governance_description,
52 deposit,
53 return_address,
54 ratified_epoch,
55 enacted_epoch,
56 dropped_epoch,
57 expired_epoch,
58 expiration,
59 }
60 }
61}
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum GovernanceType {
65 #[serde(rename = "hard_fork_initiation")]
66 HardForkInitiation,
67 #[serde(rename = "new_committee")]
68 NewCommittee,
69 #[serde(rename = "new_constitution")]
70 NewConstitution,
71 #[serde(rename = "info_action")]
72 InfoAction,
73 #[serde(rename = "no_confidence")]
74 NoConfidence,
75 #[serde(rename = "parameter_change")]
76 ParameterChange,
77 #[serde(rename = "treasury_withdrawals")]
78 TreasuryWithdrawals,
79}
80
81impl Default for GovernanceType {
82 fn default() -> GovernanceType {
83 Self::HardForkInitiation
84 }
85}
86