add state to swap genesis (#997)

This commit is contained in:
Kevin Davis 2021-08-16 10:14:48 -06:00 committed by GitHub
parent cd2827dbe7
commit 1a90c3bec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -336,6 +336,16 @@ func loadStabilityComMembers() ([]sdk.AccAddress, error) {
// Swap introduces new v0.15 swap genesis state // Swap introduces new v0.15 swap genesis state
func Swap() v0_15swap.GenesisState { func Swap() v0_15swap.GenesisState {
// TODO add swap genesis state pools := v0_15swap.AllowedPools{
return v0_15swap.DefaultGenesisState() 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)
} }

View File

@ -104,6 +104,15 @@ func TestIncentive(t *testing.T) {
require.JSONEq(t, string(bz), string(appState[v0_15incentive.ModuleName])) 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 // Compare migration against auto-generated snapshot to catch regressions
func TestAuth_Snapshot(t *testing.T) { func TestAuth_Snapshot(t *testing.T) {
bz, err := ioutil.ReadFile(filepath.Join("testdata", "kava-7-test-auth-state.json")) bz, err := ioutil.ReadFile(filepath.Join("testdata", "kava-7-test-auth-state.json"))