mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-01-13 00:35:17 +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
22 lines
667 B
Markdown
22 lines
667 B
Markdown
<!--
|
|
order: 6
|
|
-->
|
|
|
|
# Begin Block
|
|
|
|
At the start of each block, new KAVA tokens are minted and distributed
|
|
|
|
```go
|
|
// 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.
|