Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Settling auction without bids reverts

Settling auction without bids reverts

Description

The protocol states that settling an auction without bids should return the NFT back to the seller. However, the protocol reverts and the NFT is locked.

Risk

Likelihood: High

The issue occurs for any listed NFT without bids

Impact: High

The NFT is locked in the protocol

Proof of Concept

The following test case proves that the protocol reverts when trying to settle an auction without bids

function test_reverts_when_trying_to_settle_without_bids() public {
vm.prank(PROTOCOL_OWNER);
nft.mint(SELLER);
assertEq(nft.ownerOf(0), SELLER);
vm.startPrank(SELLER);
nft.approve(address(market), 0);
vm.expectEmit(true, true, true, true);
emit NftListed(0, SELLER, MIN_PRICE + 1, 0);
market.listNFT(0, MIN_PRICE + 1, 0);
vm.stopPrank();
assertEq(nft.ownerOf(0), address(market));
BidBeastsNFTMarket.Listing memory listing = market.getListing(0);
assertEq(listing.listed, true);
assertEq(listing.seller, SELLER);
assertEq(listing.minPrice, MIN_PRICE + 1);
assertEq(listing.buyNowPrice, 0);
assertEq(listing.auctionEnd, 0);
BidBeastsNFTMarket.Bid memory bid = market.getHighestBid(0);
assertEq(bid.bidder, address(0));
assertEq(bid.amount, 0);
vm.warp(5 days);
vm.startPrank(BIDDER_2);
vm.expectRevert('Auction has not started (no bids)');
market.settleAuction(0);
vm.stopPrank();
}

Recommended Mitigation

Use a similar flow to unlist NFT

function settleAuction(uint256 tokenId) external isListed(tokenId) {
Listing storage listing = listings[tokenId];
- require(listing.auctionEnd > 0, "Auction has not started (no bids)");
+ if(listing.auctionEnd) { _unlistNFT(tokenId); }
require(block.timestamp >= listing.auctionEnd, "Auction has not ended");
require(bids[tokenId].amount >= listing.minPrice, "Highest bid did not meet min price");
_executeSale(tokenId);
}
Updates

Lead Judging Commences

cryptoghost Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.