-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate.go
25 lines (20 loc) · 825 Bytes
/
migrate.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
package v3
import (
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/hap-advisors/ethermint/x/evm/types"
)
// MigrateStore sets the default for GrayGlacierBlock and MergeNetsplitBlock in ChainConfig parameter.
func MigrateStore(ctx sdk.Context, paramstore *paramtypes.Subspace) error {
if !paramstore.HasKeyTable() {
ps := paramstore.WithKeyTable(types.ParamKeyTable())
paramstore = &ps
}
prevConfig := &types.ChainConfig{}
paramstore.GetIfExists(ctx, types.ParamStoreKeyChainConfig, prevConfig)
defaultConfig := types.DefaultChainConfig()
prevConfig.GrayGlacierBlock = defaultConfig.GrayGlacierBlock
prevConfig.MergeNetsplitBlock = defaultConfig.MergeNetsplitBlock
paramstore.Set(ctx, types.ParamStoreKeyChainConfig, prevConfig)
return nil
}