Skip to content

Commit

Permalink
fix the amount collect to reward auction fee colletor
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Jun 5, 2024
1 parent 4e7a578 commit b47a5b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions x/auction/keeper/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 76 in x/auction/keeper/rewards.go

View check run for this annotation

Codecov / codecov/patch

x/auction/keeper/rewards.go#L76

Added line #L76 was not covered by tests
}
if err := auction.ValidateMinRewardsBid(minBid, msg.Amount); err != nil {
return err
Expand All @@ -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 {

Check warning on line 85 in x/auction/keeper/rewards.go

View check run for this annotation

Codecov / codecov/patch

x/auction/keeper/rewards.go#L85

Added line #L85 was not covered by tests
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

Check warning on line 93 in x/auction/keeper/rewards.go

View check run for this annotation

Codecov / codecov/patch

x/auction/keeper/rewards.go#L90-L93

Added lines #L90 - L93 were not covered by tests
}
if err = k.sendToModule(sender, msg.Amount); err != nil {
return err

Check warning on line 96 in x/auction/keeper/rewards.go

View check run for this annotation

Codecov / codecov/patch

x/auction/keeper/rewards.go#L95-L96

Added lines #L95 - L96 were not covered by tests
}
} else {
diff := msg.Amount.SubAmount(lastBid.Amount)
if err = k.sendToModule(sender, diff); err != nil {
return err

Check warning on line 101 in x/auction/keeper/rewards.go

View check run for this annotation

Codecov / codecov/patch

x/auction/keeper/rewards.go#L98-L101

Added lines #L98 - L101 were not covered by tests
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion x/leverage/keeper/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 300 in x/leverage/keeper/oracle.go

View check run for this annotation

Codecov / codecov/patch

x/leverage/keeper/oracle.go#L300

Added line #L300 was not covered by tests
}

return nil
Expand Down

0 comments on commit b47a5b8

Please sign in to comment.