From 92f7df3c9c91c3998558bd72e0fd3c9cb750f09f Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Thu, 12 May 2022 03:31:20 -0300 Subject: [PATCH] chore: document InflationCalculationFn (#11945) --- x/mint/spec/03_begin_block.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/x/mint/spec/03_begin_block.md b/x/mint/spec/03_begin_block.md index ede3d2c328..67bd7d8a8f 100644 --- a/x/mint/spec/03_begin_block.md +++ b/x/mint/spec/03_begin_block.md @@ -7,7 +7,19 @@ order: 3 Minting parameters are recalculated and inflation paid at the beginning of each block. -## NextInflationRate +## Inflation rate calculation + +Inflation rate is calculated using an "inflation calculation function" that's +passed to the `NewAppModule` function. If no function is passed, then the SDK's +default inflation function will be used (`NextInflationRate`). In case a custom +inflation calculation logic is needed, this can be achieved by defining and +passing a function that matches `InflationCalculationFn`'s signature. + +```go +type InflationCalculationFn func(ctx sdk.Context, minter Minter, params Params, bondedRatio sdk.Dec) sdk.Dec +``` + +### NextInflationRate The target annual inflation rate is recalculated each block. The inflation is also subject to a rate change (positive or negative)