pub fn compute_inflation<P: PerThing>(stake: P, ideal_stake: P, falloff: P) -> P
Expand description

Compute yearly inflation using function

I(x) = for x between 0 and x_ideal: x / x_ideal,
for x between x_ideal and 1: 2^((x_ideal - x) / d)

where:

  • x is the stake rate, i.e. fraction of total issued tokens that actively staked behind validators.
  • d is the falloff or decay_rate
  • x_ideal: the ideal stake rate.

The result is meant to be scaled with minimum inflation and maximum inflation.

(as detailed here)

Arguments are:

  • stake: The fraction of total issued tokens that actively staked behind validators. Known as x in the literature. Must be between 0 and 1.
  • ideal_stake: The fraction of total issued tokens that should be actively staked behind validators. Known as x_ideal in the literature. Must be between 0 and 1.
  • falloff: Known as decay_rate in the literature. A co-efficient dictating the strength of the global incentivization to get the ideal_stake. A higher number results in less typical inflation at the cost of greater volatility for validators. Must be more than 0.01.