diff --git a/x/auction/keeper/rewards.go b/x/auction/keeper/rewards.go index 1ce4914c1b..7275a24b92 100644 --- a/x/auction/keeper/rewards.go +++ b/x/auction/keeper/rewards.go @@ -73,7 +73,7 @@ func (k Keeper) rewardsBid(msg *auction.MsgRewardsBid) error { lastBid := store.GetValue[*auction.Bid](k.store, key, keyMsg) minBid := auction.MinRewardsBid if lastBid != nil { - minBid = lastBid.Amount.Add(minBid) + minBid = lastBid.Amount } if err := auction.ValidateMinRewardsBid(minBid, msg.Amount); err != nil { return err @@ -82,18 +82,24 @@ func (k Keeper) rewardsBid(msg *auction.MsgRewardsBid) error { sender, err := sdk.AccAddressFromBech32(msg.Sender) util.Panic(err) - if !bytes.Equal(sender, lastBid.Bidder) { - returned := coin.UmeeInt(lastBid.Amount) - if err = k.sendFromModule(lastBid.Bidder, returned); err != nil { - return err - } + if lastBid == nil { if err = k.sendToModule(sender, msg.Amount); err != nil { return err } } else { - diff := msg.Amount.SubAmount(lastBid.Amount) - if err = k.sendToModule(sender, diff); err != nil { - return err + if !bytes.Equal(sender, lastBid.Bidder) { + returned := coin.UmeeInt(lastBid.Amount) + if err = k.sendFromModule(lastBid.Bidder, returned); err != nil { + return err + } + if err = k.sendToModule(sender, msg.Amount); err != nil { + return err + } + } else { + diff := msg.Amount.SubAmount(lastBid.Amount) + if err = k.sendToModule(sender, diff); err != nil { + return err + } } } diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index 872f0a7b2b..88274c1530 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -297,7 +297,7 @@ func (k Keeper) fundModules(ctx sdk.Context, toOracle, toAuction sdk.Coins) erro } if !toAuctionCheck.IsZero() { auction.EmitFundRewardsAuction(&ctx, toOracleCheck) - return send(ctx, types.ModuleName, auction.ModuleName, toAuctionCheck) + return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, k.rewardsAuction, toAuctionCheck) } return nil