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: auction payout can be locked before execute #636

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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