Skip to content

Commit

Permalink
Update test amounts for Sqrt(XY) pool basis
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Jun 8, 2024
1 parent 2e551eb commit 6d912ff
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions x/market/keeper/msg_server_market_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func TestMarketOrder(t *testing.T) {

require.NoError(t, error)

// Validate GetMember
memberAsk, memberAskFound := testInput.MarketKeeper.GetMember(testInput.Context, denomB, denomA)
require.True(t, memberAskFound)
memberBid, memberBidFound := testInput.MarketKeeper.GetMember(testInput.Context, denomA, denomB)
require.True(t, memberBidFound)

productBefore := memberAsk.Balance.Mul(memberBid.Balance)

_, err := keeper.NewMsgServerImpl(*testInput.MarketKeeper).MarketOrder(wctx, &o)
require.NoError(t, err)

Expand All @@ -48,13 +56,20 @@ func TestMarketOrder(t *testing.T) {
*/

// Validate GetMember
memberAsk, memberAskfound := testInput.MarketKeeper.GetMember(testInput.Context, denomB, denomA)
// Calculate Product After
memberAsk, memberAskFound = testInput.MarketKeeper.GetMember(testInput.Context, denomB, denomA)
require.True(t, memberAskFound)
memberBid, memberBidFound = testInput.MarketKeeper.GetMember(testInput.Context, denomA, denomB)
require.True(t, memberBidFound)

productAfter := memberAsk.Balance.Mul(memberBid.Balance)

require.True(t, productAfter.GT(productBefore))

require.True(t, memberAskfound)
require.True(t, memberAskFound)
require.Equal(t, memberAsk.DenomA, denomB)
require.Equal(t, memberAsk.DenomB, denomA)
require.Equal(t, "18", memberAsk.Balance.String())
require.Equal(t, "121", memberAsk.Balance.String())
require.Equal(t, memberAsk.Stop, uint64(0))

// Validate order estimation
Expand Down

0 comments on commit 6d912ff

Please sign in to comment.