github.com/Finschia/finschia-sdk@v0.48.1/x/mint/spec/03_begin_block.md (about) 1 <!-- 2 order: 3 3 --> 4 5 # Begin-Block 6 7 Minting parameters are recalculated and inflation 8 paid at the beginning of each block. 9 10 ## NextInflationRate 11 12 The target annual inflation rate is recalculated each block. 13 The inflation is also subject to a rate change (positive or negative) 14 depending on the distance from the desired ratio (67%). The maximum rate change 15 possible is defined to be 13% per year, however the annual inflation is capped 16 as between 7% and 20%. 17 18 ``` 19 NextInflationRate(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) { 20 inflationRateChangePerYear = (1 - bondedRatio/params.GoalBonded) * params.InflationRateChange 21 inflationRateChange = inflationRateChangePerYear/blocksPerYr 22 23 // increase the new annual inflation for this next cycle 24 inflation += inflationRateChange 25 if inflation > params.InflationMax { 26 inflation = params.InflationMax 27 } 28 if inflation < params.InflationMin { 29 inflation = params.InflationMin 30 } 31 32 return inflation 33 } 34 ``` 35 36 ## NextAnnualProvisions 37 38 Calculate the annual provisions based on current total supply and inflation 39 rate. This parameter is calculated once per block. 40 41 ``` 42 NextAnnualProvisions(params Params, totalSupply sdk.Dec) (provisions sdk.Dec) { 43 return Inflation * totalSupply 44 ``` 45 46 ## BlockProvision 47 48 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`. 49 50 ``` 51 BlockProvision(params Params) sdk.Coin { 52 provisionAmt = AnnualProvisions/ params.BlocksPerYear 53 return sdk.NewCoin(params.MintDenom, provisionAmt.Truncate()) 54 ```