-
Notifications
You must be signed in to change notification settings - Fork 71
/
migration.go
37 lines (29 loc) · 1.07 KB
/
migration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package v7
import (
"github.com/Canto-Network/Canto/v7/x/inflation/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type InflationKeeper interface {
GetParams(ctx sdk.Context) types.Params
SetParams(ctx sdk.Context, params types.Params)
SetEpochsPerPeriod(ctx sdk.Context, epochsPerPeriod int64)
SetEpochMintProvision(ctx sdk.Context, epochMintProvision sdk.Dec)
}
func UpdateParams(ctx sdk.Context, ik InflationKeeper) error {
params := ik.GetParams(ctx)
newExp := types.ExponentialCalculation{
A: sdk.NewDec(int64(16_304_348)),
R: sdk.NewDecWithPrec(35, 2), // 35%
C: sdk.ZeroDec(),
BondingTarget: sdk.NewDecWithPrec(80, 2), // not relevant; max variance is 0
MaxVariance: sdk.ZeroDec(),
}
ctx.Logger().Info("Setting Inflation Parameters")
params.ExponentialCalculation = newExp
ik.SetParams(ctx, params)
//update EpochsPerPeriod
ik.SetEpochsPerPeriod(ctx, int64(30))
epochMintProvision := types.CalculateEpochMintProvision(params, 0, 30, sdk.NewDec(1))
ik.SetEpochMintProvision(ctx, epochMintProvision)
return nil
}