diff --git a/x/market/client/cli/query_drop_test.go b/x/market/client/cli/query_drop_test.go index e55f8c9..2294488 100644 --- a/x/market/client/cli/query_drop_test.go +++ b/x/market/client/cli/query_drop_test.go @@ -30,11 +30,11 @@ func networkWithDropObjects(t *testing.T, n int) (*network.Network, []types.Drop for i := 0; i < n; i++ { drop := types.Drop{ - Uid: uint64(i), - Owner: strconv.Itoa(i), - Pair: strconv.Itoa(i), - Drops: sdk.NewIntFromUint64(uint64(i)), - ProductBeg: sdk.NewIntFromUint64(uint64(i)), + Uid: uint64(i), + Owner: strconv.Itoa(i), + Pair: strconv.Itoa(i), + Drops: sdk.NewIntFromUint64(uint64(i)), + Product: sdk.NewIntFromUint64(uint64(i)), } nullify.Fill(&drop) state.DropList = append(state.DropList, drop) diff --git a/x/market/genesis_test.go b/x/market/genesis_test.go index b7ad238..7277a8b 100644 --- a/x/market/genesis_test.go +++ b/x/market/genesis_test.go @@ -42,20 +42,20 @@ func TestGenesis(t *testing.T) { }, DropList: []types.Drop{ { - Uid: 0, - Owner: "0", - Pair: "0", - Drops: sdk.NewIntFromUint64(uint64(0)), - ProductBeg: sdk.NewIntFromUint64(uint64(0)), - Active: true, + Uid: 0, + Owner: "0", + Pair: "0", + Drops: sdk.NewIntFromUint64(uint64(0)), + Product: sdk.NewIntFromUint64(uint64(0)), + Active: true, }, { - Uid: 1, - Owner: "1", - Pair: "1", - Drops: sdk.NewIntFromUint64(uint64(1)), - ProductBeg: sdk.NewIntFromUint64(uint64(0)), - Active: true, + Uid: 1, + Owner: "1", + Pair: "1", + Drops: sdk.NewIntFromUint64(uint64(1)), + Product: sdk.NewIntFromUint64(uint64(0)), + Active: true, }, }, MemberList: []types.Member{ diff --git a/x/market/keeper/drop_test.go b/x/market/keeper/drop_test.go index 377aa26..1a2c7fd 100644 --- a/x/market/keeper/drop_test.go +++ b/x/market/keeper/drop_test.go @@ -22,7 +22,7 @@ func createNDrop(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Drop { items[i].Owner = strconv.Itoa(i) items[i].Pair = strconv.Itoa(i) items[i].Drops = sdk.NewIntFromUint64(uint64(i)) - items[i].ProductBeg = sdk.NewIntFromUint64(uint64(i)) + items[i].Product = sdk.NewIntFromUint64(uint64(i)) keeper.SetDrop(ctx, items[i]) } diff --git a/x/market/keeper/msg_server_create_drop_test.go b/x/market/keeper/msg_server_create_drop_test.go index 67aeb87..0d7a09b 100644 --- a/x/market/keeper/msg_server_create_drop_test.go +++ b/x/market/keeper/msg_server_create_drop_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "strconv" "strings" "testing" @@ -234,10 +233,7 @@ func TestCreateDrop_Pool_Not_Active(t *testing.T) { pair, _, _, testdata := dropCommon(t, testInput) - pool, found := testInput.MarketKeeper.GetPool(testInput.Context, pair) - require.True(t, found) - - var rd = types.MsgRedeemDrop{Creator: addr, Uid: strconv.FormatUint(pool.LastDrop, 10)} + var rd = types.MsgRedeemDrop{Creator: addr, Uid: "1"} createRedeemDropResponse, redeemdropErr := keeper.NewMsgServerImpl(*testInput.MarketKeeper).RedeemDrop(sdk.WrapSDKContext(testInput.Context), &rd) require.NoError(t, redeemdropErr) require.Contains(t, createRedeemDropResponse.String(), rd.GetCreator()) @@ -299,11 +295,8 @@ func TestCreateDrop_Negative(t *testing.T) { pair, denomA, denomB, _ := dropCommon(t, testInput) - pool, found := testInput.MarketKeeper.GetPool(testInput.Context, pair) - require.True(t, found) - //validate GetDrop - drop, dropFound := testInput.MarketKeeper.GetDrop(testInput.Context, pool.LastDrop) + drop, dropFound := testInput.MarketKeeper.GetDrop(testInput.Context, uint64(1)) require.True(t, dropFound) require.Equal(t, drop.Pair, pair) //validate CreateDrop diff --git a/x/market/keeper/msg_server_redeem_drop_test.go b/x/market/keeper/msg_server_redeem_drop_test.go index 4014412..a6140f8 100644 --- a/x/market/keeper/msg_server_redeem_drop_test.go +++ b/x/market/keeper/msg_server_redeem_drop_test.go @@ -65,21 +65,9 @@ func TestRedeemDrop(t *testing.T) { // Validate RedeemDrop Uid := strconv.FormatUint(createDropResponse.Uid, 10) var rd = types.MsgRedeemDrop{Creator: addr2, Uid: Uid} - redeemDropResponse, redeemdropErr := keeper.NewMsgServerImpl(*testInput.MarketKeeper).RedeemDrop(sdk.WrapSDKContext(testInput.Context), &rd) + _, redeemdropErr := keeper.NewMsgServerImpl(*testInput.MarketKeeper).RedeemDrop(sdk.WrapSDKContext(testInput.Context), &rd) require.NoError(t, redeemdropErr) - coin1Beg, err := sdk.ParseCoinNormalized(redeemDropResponse.Coin1Beg) - require.NoError(t, err) - - coin1End, err := sdk.ParseCoinNormalized(redeemDropResponse.Coin1End) - require.NoError(t, err) - - // Drop coinEnd should be greater than coinBeg except in cases where there - // is no profit accrued in the pool since the drop was created. - // In that case round up +1 added to round down division requires coin1End+1 - // to ensure invariant is not violated. - require.True(t, (coin1End.AddAmount(sdk.NewIntFromUint64(1))).IsGTE(coin1Beg)) - // Validate Drop After Redeem Drop drop1, drop1Found := testInput.MarketKeeper.GetDrop(testInput.Context, createDropResponse.Uid) require.True(t, drop1Found) diff --git a/x/market/types/genesis_test.go b/x/market/types/genesis_test.go index aaf6e66..61f6865 100644 --- a/x/market/types/genesis_test.go +++ b/x/market/types/genesis_test.go @@ -51,20 +51,20 @@ func TestGenesisState_Validate(t *testing.T) { }, DropList: []types.Drop{ { - Uid: 0, - Owner: "0", - Pair: "0", - Drops: sdk.NewIntFromUint64(uint64(0)), - ProductBeg: sdk.NewIntFromUint64(uint64(0)), - Active: true, + Uid: 0, + Owner: "0", + Pair: "0", + Drops: sdk.NewIntFromUint64(uint64(0)), + Product: sdk.NewIntFromUint64(uint64(0)), + Active: true, }, { - Uid: 1, - Owner: "1", - Pair: "1", - Drops: sdk.NewIntFromUint64(uint64(1)), - ProductBeg: sdk.NewIntFromUint64(uint64(0)), - Active: true, + Uid: 1, + Owner: "1", + Pair: "1", + Drops: sdk.NewIntFromUint64(uint64(1)), + Product: sdk.NewIntFromUint64(uint64(0)), + Active: true, }, }, MemberList: []types.Member{