Skip to content

Commit

Permalink
fix intest redeem
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed May 3, 2024
1 parent 6ec3a76 commit 0e6dfcf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions x/metoken/keeper/intest/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1713,13 +1713,11 @@ func verifyRedeem(
amountToWithdraw := redeemExchangeRate.MulInt(tc.asset.Amount).Mul(assetExponentFactorVsMeToken).TruncateInt()

// totalfee = feeRate * amount_to_redeem
totalFee := sdk.NewCoin(tc.denom, feeRate.MulInt(tc.asset.Amount).TruncateInt())
totalFee := sdk.NewCoin(tc.denom, feeRate.MulInt(amountToWithdraw).TruncateInt())
feeToAuction := params.RewardsAuctionFactor.Mul(totalFee.Amount)
feeToReserve := totalFee.Amount.Sub(feeToAuction)

// amount_to_redeem = amountToWithdraw - expectedFee
amountToRedeem := amountToWithdraw.Sub(totalFee.Amount)

expectedAssets := sdk.NewCoin(
tc.denom,
amountToRedeem,
Expand All @@ -1734,8 +1732,8 @@ func verifyRedeem(

require := require.New(t)
// verify the outputs of swap function
require.Equal(totalFee, resp.Fee, tc.name)
require.Equal(expectedAssets, resp.Returned, tc.name)
require.Equal(totalFee, resp.Fee, tc.name, "expectedFee")
require.Equal(expectedAssets, resp.Returned, tc.name, "expectedAssets")

// verify meToken balance decreased and asset balance increased by the expected amounts
require.Equal(
Expand Down

0 comments on commit 0e6dfcf

Please sign in to comment.