Skip to main content

blockfrost_openapi/models/
pool_votes_inner.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct PoolVotesInner {
6    /// Hash of the proposal transaction.
7    #[serde(rename = "tx_hash")]
8    pub tx_hash: String,
9    /// Index of the certificate within the proposal transaction.
10    #[serde(rename = "cert_index")]
11    pub cert_index: i32,
12    /// The Vote. Can be one of yes, no, abstain.
13    #[serde(rename = "vote")]
14    pub vote: Vote,
15}
16
17impl PoolVotesInner {
18    pub fn new(tx_hash: String, cert_index: i32, vote: Vote) -> PoolVotesInner {
19        PoolVotesInner {
20            tx_hash,
21            cert_index,
22            vote,
23        }
24    }
25}
26/// The Vote. Can be one of yes, no, abstain.
27#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
28pub enum Vote {
29    #[serde(rename = "yes")]
30    Yes,
31    #[serde(rename = "no")]
32    No,
33    #[serde(rename = "abstain")]
34    Abstain,
35}
36
37impl Default for Vote {
38    fn default() -> Vote {
39        Self::Yes
40    }
41}
42