From d489bacfacac78edfe509941762a25864e7fef1d Mon Sep 17 00:00:00 2001 From: Ruaridh Date: Mon, 11 May 2020 21:07:39 +0100 Subject: [PATCH] tidy payout function Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- x/auction/keeper/auctions.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/x/auction/keeper/auctions.go b/x/auction/keeper/auctions.go index 8a66f939..e3c6a1df 100644 --- a/x/auction/keeper/auctions.go +++ b/x/auction/keeper/auctions.go @@ -350,11 +350,12 @@ func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, a types.CollateralAuc } for i, payout := range lotPayouts { // if the payout amount is 0, don't send 0 coins - if payout.IsPositive() { - err = k.supplyKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, a.LotReturns.Addresses[i], sdk.NewCoins(payout)) - if err != nil { - return a, err - } + if !payout.IsPositive() { + break + } + err = k.supplyKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, a.LotReturns.Addresses[i], sdk.NewCoins(payout)) + if err != nil { + return a, err } }