ergo_lib_wasm/
parameters.rs

1//! Blockchain parameters. This module defines adjustable blockchain parameters that can be voted on by miners
2
3use ergo_lib::chain::parameters;
4use wasm_bindgen::prelude::*;
5extern crate derive_more;
6use derive_more::{From, Into};
7
8/// Blockchain parameters
9#[wasm_bindgen]
10#[derive(PartialEq, Debug, Clone, Eq, From, Into)]
11pub struct Parameters(pub(crate) parameters::Parameters);
12
13#[wasm_bindgen]
14impl Parameters {
15    /// Return default blockchain parameters that were set at genesis
16    pub fn default_parameters() -> Parameters {
17        parameters::Parameters::default().into()
18    }
19    /// Get current block version
20    pub fn block_version(&self) -> i32 {
21        self.0.block_version()
22    }
23    /// Cost of storing 1 byte per Storage Period of block chain
24    pub fn storage_fee_factor(&self) -> i32 {
25        self.0.storage_fee_factor()
26    }
27    /// Minimum value per byte an output must have to not be considered dust
28    pub fn min_value_per_byte(&self) -> i32 {
29        self.0.min_value_per_byte()
30    }
31    /// Maximum size of transactions size in a block
32    pub fn max_block_size(&self) -> i32 {
33        self.0.max_block_size()
34    }
35    /// Maximum total computation cost in a block
36    pub fn max_block_cost(&self) -> i32 {
37        self.0.max_block_cost()
38    }
39    /// Cost of accessing a single token
40    pub fn token_access_cost(&self) -> i32 {
41        self.0.token_access_cost()
42    }
43    /// Validation cost per one transaction input
44    pub fn input_cost(&self) -> i32 {
45        self.0.input_cost()
46    }
47    /// Validation cost per data input
48    pub fn data_input_cost(&self) -> i32 {
49        self.0.data_input_cost()
50    }
51    /// Validation cost per one output
52    pub fn output_cost(&self) -> i32 {
53        self.0.output_cost()
54    }
55}