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(auctions): min bid wasn't calculated correctly for tiny auctions #74

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rhuairahrighairidh
Copy link
Member

For tiny (forward) auctions, the bot could bid the same as the current bid. This is never allowed by the chain as all bids must at least be 1 unit larger than previous.

This PR replicates the bug in a test and copies in the min bid calculation from the auction module.

- replace deprecated exportloopref with copyloopvar
- move skip-dirs to issues section
- remove some broken configs in favour of defaults
dockerfile was running into build errors
@@ -1,4 +1,4 @@
FROM golang:1.21.9-bookworm as build-env
FROM golang:1.23.6-bookworm AS build-env
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thnx for updating and fixing the case warning

@@ -258,18 +261,25 @@ func calculateUSDValue(coin sdk.Coin, assetInfo AssetInfo) sdk.Dec {
return coin.Amount.ToLegacyDec().Quo(assetInfo.ConversionFactor.ToLegacyDec()).Mul(assetInfo.Price)
}

// calculateProposedBid tries to find a bid amount for a forward auction.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment is appreciated 👍

return currentBid.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost
sdk.MaxInt(
sdk.NewInt(1),
sdk.NewDecFromInt(currentBid).Mul(increment).RoundInt(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thnx for removing the hard coded increment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants