-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: master
Are you sure you want to change the base?
Conversation
- 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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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
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.