Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the rewards collects for bid #2539

Merged
merged 9 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
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 @@
}
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
Loading