2022-05-31 16:28:46 +00:00
|
|
|
package v011
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
|
|
|
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
2022-06-19 09:43:41 +00:00
|
|
|
v010types "github.com/evmos/ethermint/x/feemarket/migrations/v010/types"
|
|
|
|
"github.com/evmos/ethermint/x/feemarket/types"
|
2022-05-31 16:28:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// MigrateStore adds the MinGasPrice param with a value of 0
|
2022-06-05 09:22:33 +00:00
|
|
|
// and MinGasMultiplier to 0,5
|
2022-05-31 16:28:46 +00:00
|
|
|
func MigrateStore(ctx sdk.Context, paramstore *paramtypes.Subspace) error {
|
|
|
|
if !paramstore.HasKeyTable() {
|
|
|
|
ps := paramstore.WithKeyTable(types.ParamKeyTable())
|
|
|
|
paramstore = &ps
|
|
|
|
}
|
|
|
|
|
2022-06-05 09:22:33 +00:00
|
|
|
// add MinGasPrice
|
|
|
|
paramstore.Set(ctx, types.ParamStoreKeyMinGasPrice, types.DefaultMinGasPrice)
|
|
|
|
// add MinGasMultiplier
|
|
|
|
paramstore.Set(ctx, types.ParamStoreKeyMinGasMultiplier, types.DefaultMinGasMultiplier)
|
2022-05-31 16:28:46 +00:00
|
|
|
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
|
2022-06-05 09:22:33 +00:00
|
|
|
// - add MinGasMultiplier param
|
2022-05-31 16:28:46 +00:00
|
|
|
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,
|
2022-06-05 09:22:33 +00:00
|
|
|
MinGasPrice: types.DefaultMinGasPrice,
|
|
|
|
MinGasMultiplier: types.DefaultMinGasMultiplier,
|
2022-05-31 16:28:46 +00:00
|
|
|
},
|
|
|
|
BlockGas: oldState.BlockGas,
|
|
|
|
}
|
|
|
|
}
|