mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
4c1524d7bc
* refactor begin blocker to single func * remove unused inflation keeper methods * refactor to private keeper methods * add testcase for failed mint due to invalid param * add testcase for GetStakingApy() * check for zero instead of empty * actually test super long block time * skip fund account for earn community proposals * test x/community keeper GetModuleAccountBalance * update x/kavamint begin block spec
667 B
667 B
Begin Block
At the start of each block, new KAVA tokens are minted and distributed
// BeginBlocker mints & distributes new tokens for the previous block.
func BeginBlocker(ctx sdk.Context, k Keeper) {
if err := k.AccumulateAndMintInflation(ctx); err != nil {
panic(err)
}
}
AccumulateAndMintInflation
defines all sources of inflation from yearly APYs set via the parameters.
Those rates are converted to the effective rate of the yearly interest rate assuming it is
compounded once per second, for the number of seconds since the previous mint. See concepts for
more details on calculations & the defined sources of inflation.