Skip to content

Commit

Permalink
tests(escrow): adding hasBalance check for module acc
Browse files Browse the repository at this point in the history
  • Loading branch information
seantking committed Oct 8, 2021
1 parent 535e2c6 commit 5bd0e32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion modules/apps/29-fee/keeper/escrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func (k Keeper) EscrowPacketFee(ctx sdk.Context, refundAcc sdk.AccAddress, fee t
for _, f := range fees {
fmt.Print(f)
hasBalance := k.bankKeeper.HasBalance(ctx, refundAcc, f)
fmt.Print(hasBalance)
if !hasBalance {
return sdkerrors.Wrap(types.ErrBalanceNotFound, fmt.Sprintf("%s", refundAcc.String()))
}
Expand Down
4 changes: 4 additions & 0 deletions modules/apps/29-fee/keeper/escrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ func (suite *KeeperTestSuite) TestEscrowPacketFee() {

if tc.expPass {
feeInEscrow, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeInEscrow(suite.chainA.GetContext(), refundAcc.String(), packetId.ChannelId, packetId.Sequence)
// check if the escrowed fee is set in state
suite.Require().Equal(fee.AckFee, feeInEscrow.AckFee)
suite.Require().Equal(fee.ReceiveFee, feeInEscrow.ReceiveFee)
suite.Require().Equal(fee.TimeoutFee, feeInEscrow.TimeoutFee)
// check if the balance for the module account is correct and the fee is correctly escrowed
hasBalance := suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(300)})
suite.Require().True(hasBalance)
suite.Require().NoError(err)
} else {
suite.Require().Error(err)
Expand Down

0 comments on commit 5bd0e32

Please sign in to comment.