2022-04-21 20:16:28 +00:00
|
|
|
package v0_17
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
2022-04-22 18:36:05 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
2022-04-21 20:16:28 +00:00
|
|
|
|
2022-04-22 16:22:20 +00:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2022-04-22 15:58:55 +00:00
|
|
|
authz "github.com/cosmos/cosmos-sdk/x/authz"
|
2022-04-21 20:16:28 +00:00
|
|
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
|
|
|
evmtypes "github.com/tharsis/ethermint/x/evm/types"
|
|
|
|
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
|
|
|
|
|
|
|
|
evmutiltypes "github.com/kava-labs/kava/x/evmutil/types"
|
2022-04-22 16:22:20 +00:00
|
|
|
|
|
|
|
bridgetypes "github.com/kava-labs/kava-bridge/x/bridge/types"
|
2022-04-22 18:36:05 +00:00
|
|
|
v016auction "github.com/kava-labs/kava/x/auction/legacy/v0_16"
|
|
|
|
v017auction "github.com/kava-labs/kava/x/auction/legacy/v0_17"
|
|
|
|
auctiontypes "github.com/kava-labs/kava/x/auction/types"
|
2022-04-21 20:16:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func migrateAppState(appState genutiltypes.AppMap, clientCtx client.Context) {
|
2022-04-22 18:36:05 +00:00
|
|
|
interfaceRegistry := types.NewInterfaceRegistry()
|
|
|
|
v016auction.RegisterInterfaces(interfaceRegistry)
|
|
|
|
v16Codec := codec.NewProtoCodec(interfaceRegistry)
|
|
|
|
|
2022-04-21 20:16:28 +00:00
|
|
|
codec := clientCtx.Codec
|
|
|
|
|
|
|
|
// x/emvutil
|
|
|
|
evmUtilGenState := evmutiltypes.NewGenesisState([]evmutiltypes.Account{})
|
|
|
|
appState[evmutiltypes.ModuleName] = codec.MustMarshalJSON(evmUtilGenState)
|
|
|
|
|
|
|
|
// x/evm
|
|
|
|
evmGenState := &evmtypes.GenesisState{
|
|
|
|
Accounts: []evmtypes.GenesisAccount{},
|
|
|
|
Params: evmtypes.Params{
|
|
|
|
EvmDenom: "akava",
|
|
|
|
EnableCreate: true,
|
|
|
|
EnableCall: true,
|
|
|
|
ChainConfig: evmtypes.DefaultChainConfig(),
|
|
|
|
ExtraEIPs: nil,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
appState[evmtypes.ModuleName] = codec.MustMarshalJSON(evmGenState)
|
|
|
|
|
2022-04-22 16:22:20 +00:00
|
|
|
// x/bridge
|
|
|
|
bridgeGenState := bridgetypes.NewGenesisState(
|
|
|
|
bridgetypes.NewParams(
|
|
|
|
false, // Bridge disabled
|
|
|
|
bridgetypes.EnabledERC20Tokens{}, // No bridge ERC20 tokens
|
|
|
|
nil, // No relayer
|
|
|
|
bridgetypes.ConversionPairs{}, // No conversion pairs
|
|
|
|
),
|
|
|
|
bridgetypes.ERC20BridgePairs{}, // Empty state as there has been no ERC20 contracts deployed
|
|
|
|
sdk.OneInt(), // NextWithdrawSequence starts at 1
|
|
|
|
)
|
|
|
|
appState[bridgetypes.ModuleName] = codec.MustMarshalJSON(&bridgeGenState)
|
|
|
|
|
2022-04-21 20:16:28 +00:00
|
|
|
// x/feemarket
|
|
|
|
feemarketState := feemarkettypes.DefaultGenesisState()
|
|
|
|
appState[feemarkettypes.ModuleName] = codec.MustMarshalJSON(feemarketState)
|
2022-04-22 15:58:55 +00:00
|
|
|
|
|
|
|
// x/authz
|
|
|
|
authzState := authz.DefaultGenesisState()
|
|
|
|
appState[authz.ModuleName] = codec.MustMarshalJSON(authzState)
|
2022-04-22 18:36:05 +00:00
|
|
|
|
|
|
|
// x/auction
|
|
|
|
if appState[auctiontypes.ModuleName] != nil {
|
|
|
|
var v16GenState v016auction.GenesisState
|
|
|
|
v16Codec.MustUnmarshalJSON(appState[auctiontypes.ModuleName], &v16GenState)
|
|
|
|
|
|
|
|
migratedState := v017auction.Migrate(v16GenState)
|
|
|
|
encodedState := codec.MustMarshalJSON(migratedState)
|
|
|
|
|
|
|
|
appState[auctiontypes.ModuleName] = encodedState
|
|
|
|
}
|
2022-04-21 20:16:28 +00:00
|
|
|
}
|