-
Notifications
You must be signed in to change notification settings - Fork 127
/
upgrades.go
42 lines (34 loc) · 1.46 KB
/
upgrades.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
38
39
40
41
42
package v174
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
liquidvestingkeeper "github.com/haqq-network/haqq/x/liquidvesting/keeper"
)
// CreateUpgradeHandler creates an SDK upgrade handler for v1.7.4
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
ak authkeeper.AccountKeeper,
lk liquidvestingkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger()
logger.Info("##############################################")
logger.Info("############ Run migration v1.7.4 ############")
logger.Info("################ REVESTING V2 ################")
logger.Info("##############################################")
if err := StretchLockupScheduleForAccounts(ctx, ak, VestingStretchLength, time.Unix(LockupLengthThreshold, 0)); err != nil {
panic(err)
}
if err := StretchLockupScheduleForLiquidVestingTokens(ctx, lk, VestingStretchLength, time.Unix(LockupLengthThreshold, 0)); err != nil {
panic(err)
}
logger.Info("##############################################")
logger.Info("############# REVESTING COMPLETE #############")
logger.Info("##############################################")
return mm.RunMigrations(ctx, configurator, vm)
}
}