-
Notifications
You must be signed in to change notification settings - Fork 8
/
migrate.go
43 lines (38 loc) · 1.51 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package v011
import (
sdk "github.com/cosmos/cosmos-sdk/types"
v010types "github.com/cerc-io/laconicd/x/feemarket/migrations/v010/types"
"github.com/cerc-io/laconicd/x/feemarket/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
// MigrateStore adds the MinGasPrice param with a value of 0
// and MinGasMultiplier to 0,5
func MigrateStore(ctx sdk.Context, paramstore *paramtypes.Subspace) error {
if !paramstore.HasKeyTable() {
ps := paramstore.WithKeyTable(types.ParamKeyTable())
paramstore = &ps
}
// add MinGasPrice
paramstore.Set(ctx, types.ParamStoreKeyMinGasPrice, types.DefaultMinGasPrice)
// add MinGasMultiplier
paramstore.Set(ctx, types.ParamStoreKeyMinGasMultiplier, types.DefaultMinGasMultiplier)
return nil
}
// MigrateJSON accepts exported v0.10 x/feemarket genesis state and migrates it to
// v0.11 x/feemarket genesis state. The migration includes:
// - add MinGasPrice param
// - add MinGasMultiplier param
func MigrateJSON(oldState v010types.GenesisState) types.GenesisState {
return types.GenesisState{
Params: types.Params{
NoBaseFee: oldState.Params.NoBaseFee,
BaseFeeChangeDenominator: oldState.Params.BaseFeeChangeDenominator,
ElasticityMultiplier: oldState.Params.ElasticityMultiplier,
EnableHeight: oldState.Params.EnableHeight,
BaseFee: oldState.Params.BaseFee,
MinGasPrice: types.DefaultMinGasPrice,
MinGasMultiplier: types.DefaultMinGasMultiplier,
},
BlockGas: oldState.BlockGas,
}
}