Skip to content

Conversation

Leechael
Copy link

@Leechael Leechael commented Apr 3, 2024

In the collectAuctionPayout function, it becomes apparent that the variable paidOutBidAmount is set to true before the necessary require checks are performed. This has the potential to cause an issue where the auction creator does not receive their tokens, even if the auction is successful and has expired.

function collectAuctionPayout(uint256 _auctionId) external nonReentrant {
require(
!_englishAuctionsStorage().payoutStatus[_auctionId].paidOutBidAmount,
"Marketplace: payout already completed."
);
_englishAuctionsStorage().payoutStatus[_auctionId].paidOutBidAmount = true;
Auction memory _targetAuction = _englishAuctionsStorage().auctions[_auctionId];
Bid memory _winningBid = _englishAuctionsStorage().winningBid[_auctionId];
require(_targetAuction.status != IEnglishAuctions.Status.CANCELLED, "Marketplace: invalid auction.");
require(_targetAuction.endTimestamp <= block.timestamp, "Marketplace: auction still active.");
require(_winningBid.bidder != address(0), "Marketplace: no bids were made.");
_closeAuctionForAuctionCreator(_targetAuction, _winningBid);
if (_targetAuction.status != IEnglishAuctions.Status.COMPLETED) {
_englishAuctionsStorage().auctions[_auctionId].status = IEnglishAuctions.Status.COMPLETED;
}
}

This PR aims to fix the potential issue.

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.

1 participant