Skip to main content

blockfrost_openapi/models/
protocol_parameters.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4/// ProtocolParameters : Protocol cryptographic parameters
5#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
6pub struct ProtocolParameters {
7    /// Quorum parameter
8    #[serde(rename = "k")]
9    pub k: i64,
10    /// Security parameter (number of lotteries)
11    #[serde(rename = "m")]
12    pub m: i64,
13    /// f in phi(w) = 1 - (1 - f)^w, where w is the stake of a participant
14    #[serde(rename = "phi_f")]
15    pub phi_f: f64,
16}
17
18impl ProtocolParameters {
19    /// Protocol cryptographic parameters
20    pub fn new(k: i64, m: i64, phi_f: f64) -> ProtocolParameters {
21        ProtocolParameters {
22            k,
23            m,
24            phi_f,
25        }
26    }
27}
28