diff --git a/migrate/v0_17/kava.go b/migrate/v0_17/kava.go index 1d29ce14..2788a8ef 100644 --- a/migrate/v0_17/kava.go +++ b/migrate/v0_17/kava.go @@ -18,6 +18,7 @@ import ( v017auction "github.com/kava-labs/kava/x/auction/legacy/v0_17" auctiontypes "github.com/kava-labs/kava/x/auction/types" incentivetypes "github.com/kava-labs/kava/x/incentive/types" + savingstypes "github.com/kava-labs/kava/x/savings/types" ) func migrateAppState(appState genutiltypes.AppMap, clientCtx client.Context) { @@ -83,4 +84,8 @@ func migrateAppState(appState genutiltypes.AppMap, clientCtx client.Context) { appState[incentivetypes.ModuleName] = codec.MustMarshalJSON(&incentiveState) } + + // x/savings + savingsState := savingstypes.DefaultGenesisState() + appState[savingstypes.ModuleName] = codec.MustMarshalJSON(&savingsState) } diff --git a/migrate/v0_17/migrate_test.go b/migrate/v0_17/migrate_test.go index 4bf96698..5afa886c 100644 --- a/migrate/v0_17/migrate_test.go +++ b/migrate/v0_17/migrate_test.go @@ -21,6 +21,7 @@ import ( auctiontypes "github.com/kava-labs/kava/x/auction/types" evmutiltypes "github.com/kava-labs/kava/x/evmutil/types" incentivetypes "github.com/kava-labs/kava/x/incentive/types" + savingstypes "github.com/kava-labs/kava/x/savings/types" ) func TestMigrateGenesisDoc(t *testing.T) { @@ -113,6 +114,17 @@ func TestMigrateIncentive(t *testing.T) { assert.Len(t, genstate.Params.SavingsRewardPeriods, 0) } +func TestMigrateSavings(t *testing.T) { + appMap, ctx := migrateToV17AndGetAppMap(t) + var genstate savingstypes.GenesisState + err := ctx.Codec.UnmarshalJSON(appMap[savingstypes.ModuleName], &genstate) + assert.NoError(t, err) + assert.Len(t, genstate.Deposits, 0) + assert.Equal(t, genstate.Params, savingstypes.Params{ + SupportedDenoms: []string{}, + }) +} + func migrateToV17AndGetAppMap(t *testing.T) (genutiltypes.AppMap, client.Context) { genDoc, err := tmtypes.GenesisDocFromFile(filepath.Join("testdata", "genesis-v16.json")) assert.NoError(t, err) diff --git a/migrate/v0_17/testdata/genesis-v17.json b/migrate/v0_17/testdata/genesis-v17.json index 6ad5966f..785dc0b9 100644 --- a/migrate/v0_17/testdata/genesis-v17.json +++ b/migrate/v0_17/testdata/genesis-v17.json @@ -2239,6 +2239,12 @@ }, "authz": { "authorization": [] + }, + "savings": { + "deposits": [], + "params": { + "supported_denoms": [] + } } } }