Macro pallet_staking_reward_curve::build
source · build!() { /* proc-macro */ }
Expand description
Accepts a number of expressions to create a instance of PiecewiseLinear which represents the NPoS curve (as detailed here) for those parameters. Parameters are:
-
min_inflation
: the minimal amount to be rewarded between validators, expressed as a fraction of total issuance. Known asI_0
in the literature. Expressed in millionth, must be between 0 and 1_000_000. -
max_inflation
: the maximum amount to be rewarded between validators, expressed as a fraction of total issuance. This is attained only whenideal_stake
is achieved. Expressed in millionth, must be between min_inflation and 1_000_000. -
ideal_stake
: the fraction of total issued tokens that should be actively staked behind validators. Known asx_ideal
in the literature. Expressed in millionth, must be between 0_100_000 and 0_900_000. -
falloff
: Known asdecay_rate
in the literature. A co-efficient dictating the strength of the global incentivization to get theideal_stake
. A higher number results in less typical inflation at the cost of greater volatility for validators. Expressed in millionth, must be between 0 and 1_000_000. -
max_piece_count
: The maximum number of pieces in the curve. A greater number uses more resources but results in higher accuracy. Must be between 2 and 1_000. -
test_precision
: The maximum error allowed in the generated test. Expressed in millionth, must be between 0 and 1_000_000.
Example
use sp_runtime::curve::PiecewiseLinear;
pallet_staking_reward_curve::build! {
const I_NPOS: PiecewiseLinear<'static> = curve!(
min_inflation: 0_025_000,
max_inflation: 0_100_000,
ideal_stake: 0_500_000,
falloff: 0_050_000,
max_piece_count: 40,
test_precision: 0_005_000,
);
}