Skip to main content

blockfrost_openapi/models/
pool.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5pub struct Pool {
6    /// Bech32 pool ID
7    #[serde(rename = "pool_id")]
8    pub pool_id: String,
9    /// Hexadecimal pool ID.
10    #[serde(rename = "hex")]
11    pub hex: String,
12    /// VRF key hash
13    #[serde(rename = "vrf_key")]
14    pub vrf_key: String,
15    /// Total minted blocks
16    #[serde(rename = "blocks_minted")]
17    pub blocks_minted: i32,
18    /// Number of blocks minted in the current epoch
19    #[serde(rename = "blocks_epoch")]
20    pub blocks_epoch: i32,
21    #[serde(rename = "live_stake")]
22    pub live_stake: String,
23    #[serde(rename = "live_size")]
24    pub live_size: f64,
25    #[serde(rename = "live_saturation")]
26    pub live_saturation: f64,
27    #[serde(rename = "live_delegators")]
28    pub live_delegators: f64,
29    #[serde(rename = "active_stake")]
30    pub active_stake: String,
31    #[serde(rename = "active_size")]
32    pub active_size: f64,
33    /// Stake pool certificate pledge
34    #[serde(rename = "declared_pledge")]
35    pub declared_pledge: String,
36    /// Stake pool current pledge
37    #[serde(rename = "live_pledge")]
38    pub live_pledge: String,
39    /// Margin tax cost of the stake pool
40    #[serde(rename = "margin_cost")]
41    pub margin_cost: f64,
42    /// Fixed tax cost of the stake pool
43    #[serde(rename = "fixed_cost")]
44    pub fixed_cost: String,
45    /// Bech32 reward account of the stake pool
46    #[serde(rename = "reward_account")]
47    pub reward_account: String,
48    #[serde(rename = "owners")]
49    pub owners: Vec<String>,
50    #[serde(rename = "registration")]
51    pub registration: Vec<String>,
52    #[serde(rename = "retirement")]
53    pub retirement: Vec<String>,
54    #[serde(rename = "calidus_key", deserialize_with = "Option::deserialize")]
55    pub calidus_key: Option<Box<models::PoolCalidusKey>>,
56}
57
58impl Pool {
59    pub fn new(pool_id: String, hex: String, vrf_key: String, blocks_minted: i32, blocks_epoch: i32, live_stake: String, live_size: f64, live_saturation: f64, live_delegators: f64, active_stake: String, active_size: f64, declared_pledge: String, live_pledge: String, margin_cost: f64, fixed_cost: String, reward_account: String, owners: Vec<String>, registration: Vec<String>, retirement: Vec<String>, calidus_key: Option<models::PoolCalidusKey>) -> Pool {
60        Pool {
61            pool_id,
62            hex,
63            vrf_key,
64            blocks_minted,
65            blocks_epoch,
66            live_stake,
67            live_size,
68            live_saturation,
69            live_delegators,
70            active_stake,
71            active_size,
72            declared_pledge,
73            live_pledge,
74            margin_cost,
75            fixed_cost,
76            reward_account,
77            owners,
78            registration,
79            retirement,
80            calidus_key: if let Some(x) = calidus_key {Some(Box::new(x))} else {None},
81        }
82    }
83}
84