The checkAuctionEnded
function does not finalize the auction or prevent further bids. After the auction ends, users could still call buy
if the state.endTime
is not enforced.
The checkAuctionEnded
function is intended to check if the auction has ended (i.e., the current time is past the state.endTime
). However, it does not update the contract state to mark the auction as ended or prevent further bids. As a result, users could still call the buy
function after the auction has ended, as long as the state.endTime
is not enforced in the buy
function.
Users can continue to place bids even after the auction has officially ended, leading to unfair advantages or exploitation.
The state.endTime
is reached, but the auction is not marked as ended.
The checkAuctionEnded
function can be called, but it does not update the contract state to prevent further bids.
Users can still call the buy
function and place bids, even though the auction is supposed to be over.
This could lead to unfair advantages, such as users buying tokens at the reserve price after the auction has ended.
The contract state (e.g., state.totalRemaining
, state.lastBidder
) may not reflect the true state of the auction, leading to confusion or exploitation.
This is the example scenario
Auction Parameters:
startTime
: 10:00 AM
endTime
: 12:00 PM
startingPrice
: 100 USDC per ZENO
reservePrice
: 50 USDC per ZENO
Auction Ends:
At 12:00 PM, the auction officially ends.
The checkAuctionEnded
function is called, but it does not mark the auction as ended.
Exploitation:
At 12:05 PM, a user calls the buy
function and purchases ZENO tokens at the reserve price (50 USDC per ZENO).
This is unfair to other users who followed the rules and stopped bidding at 12:00 PM.
Manual Review
After implementing following fix then once the auction ends, no further bids can be placed, ensuring fairness and consistency:
Add auctionEnded state variable to track whether the aution has ended. It is set to true
when the checkAuctionEnded
function is called after the auction end time.
The whenActive
modifier now checks if the auction has ended (!auctionEnded
). This prevents the buy
function from being called after the auction has ended.
The checkAuctionEnded()
function now marks the auction as ended by setting auctionEnded = true
. It also emits an AuctionEnded
event for transparency.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.