2019-12-17 03:44:44 -08:00
<!--
2019-12-11 09:35:27 -08:00
order: 3
2019-12-17 03:44:44 -08:00
-->
2019-12-11 09:35:27 -08:00
2018-10-19 11:36:00 -07:00
# Begin-Block
2018-12-04 10:17:02 -08:00
Minting parameters are recalculated and inflation
paid at the beginning of each block.
2018-10-19 11:36:00 -07:00
2018-11-26 04:13:47 -08:00
## NextInflationRate
2018-10-19 11:36:00 -07:00
2018-12-04 10:17:02 -08:00
The target annual inflation rate is recalculated each block.
The inflation is also subject to a rate change (positive or negative)
2018-11-26 04:13:47 -08:00
depending on the distance from the desired ratio (67%). The maximum rate change
possible is defined to be 13% per year, however the annual inflation is capped
as between 7% and 20%.
2018-10-19 11:36:00 -07:00
2018-11-26 04:13:47 -08:00
```
NextInflationRate(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) {
2018-10-19 11:36:00 -07:00
inflationRateChangePerYear = (1 - bondedRatio/params.GoalBonded) * params.InflationRateChange
2018-12-04 10:17:02 -08:00
inflationRateChange = inflationRateChangePerYear/blocksPerYr
2018-10-19 11:36:00 -07:00
// increase the new annual inflation for this next cycle
inflation += inflationRateChange
if inflation > params.InflationMax {
inflation = params.InflationMax
}
if inflation < params.InflationMin {
inflation = params.InflationMin
}
return inflation
2019-07-01 09:47:55 -07:00
}
2018-11-26 04:13:47 -08:00
```
## NextAnnualProvisions
Calculate the annual provisions based on current total supply and inflation
rate. This parameter is calculated once per block.
```
NextAnnualProvisions(params Params, totalSupply sdk.Dec) (provisions sdk.Dec) {
return Inflation * totalSupply
```
## BlockProvision
2019-07-01 09:47:55 -07:00
Calculate the provisions generated for each block based on current annual provisions. The provisions are then minted by the `mint` module's `ModuleMinterAccount` and then transferred to the `auth` 's `FeeCollector` `ModuleAccount` .
2018-11-26 04:13:47 -08:00
```
BlockProvision(params Params) sdk.Coin {
provisionAmt = AnnualProvisions/ params.BlocksPerYear
return sdk.NewCoin(params.MintDenom, provisionAmt.Truncate())
```