From 1a90c3bec65fa3a39ed47270a42c345435f34985 Mon Sep 17 00:00:00 2001 From: Kevin Davis Date: Mon, 16 Aug 2021 10:14:48 -0600 Subject: [PATCH] add state to swap genesis (#997) --- migrate/v0_15/migrate.go | 14 ++++++++++++-- migrate/v0_15/migrate_test.go | 9 +++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/migrate/v0_15/migrate.go b/migrate/v0_15/migrate.go index befe198a..64680584 100644 --- a/migrate/v0_15/migrate.go +++ b/migrate/v0_15/migrate.go @@ -336,6 +336,16 @@ func loadStabilityComMembers() ([]sdk.AccAddress, error) { // Swap introduces new v0.15 swap genesis state func Swap() v0_15swap.GenesisState { - // TODO add swap genesis state - return v0_15swap.DefaultGenesisState() + pools := v0_15swap.AllowedPools{ + v0_15swap.NewAllowedPool("bnb", "usdx"), + v0_15swap.NewAllowedPool("btcb", "usdx"), + v0_15swap.NewAllowedPool("busd", "usdx"), + v0_15swap.NewAllowedPool("hard", "usdx"), + v0_15swap.NewAllowedPool("swp", "usdx"), + v0_15swap.NewAllowedPool("ukava", "usdx"), + v0_15swap.NewAllowedPool("usdx", "xrpb"), + } + fee := sdk.MustNewDecFromStr("0.0015") + params := v0_15swap.NewParams(pools, fee) + return v0_15swap.NewGenesisState(params, v0_15swap.DefaultPoolRecords, v0_15swap.DefaultShareRecords) } diff --git a/migrate/v0_15/migrate_test.go b/migrate/v0_15/migrate_test.go index b67d2527..8d4047ac 100644 --- a/migrate/v0_15/migrate_test.go +++ b/migrate/v0_15/migrate_test.go @@ -104,6 +104,15 @@ func TestIncentive(t *testing.T) { require.JSONEq(t, string(bz), string(appState[v0_15incentive.ModuleName])) } +func TestSwap(t *testing.T) { + swapGS := Swap() + err := swapGS.Validate() + require.NoError(t, err) + require.Equal(t, 7, len(swapGS.Params.AllowedPools)) + require.Equal(t, 0, len(swapGS.PoolRecords)) + require.Equal(t, 0, len(swapGS.ShareRecords)) +} + // Compare migration against auto-generated snapshot to catch regressions func TestAuth_Snapshot(t *testing.T) { bz, err := ioutil.ReadFile(filepath.Join("testdata", "kava-7-test-auth-state.json"))