Platform: Code4rena
Start Date: 06/09/2022
Pot Size: $90,000 USDC
Total HM: 33
Participants: 168
Period: 9 days
Judge: GalloDaSballo
Total Solo HM: 10
Id: 157
League: ETH
Rank: 154/168
Findings: 1
Award: $45.47
š Selected for report: 0
š Solo Findings: 0
š Selected for report: pfapostol
Also found by: 0x1f8b, 0x4non, 0x5rings, 0xA5DF, 0xSmartContract, 0xc0ffEE, 0xkatana, Aymen0909, Bnke0x0, CertoraInc, Chandr, CodingNameKiki, Cr4ckM3, Deivitto, DimSon, Franfran, JAGADESH, JC, Jeiwan, Lambda, LeoS, Matin, Metatron, Migue, MiloTruck, PPrieditis, PaludoX0, R2, RaymondFam, Respx, ReyAdmirado, Rolezn, Saintcode_, Samatak, SnowMan, StevenL, Tointer, TomJ, Tomo, WatchDogs, Waze, _Adam, __141345__, ajtra, asutorufos, ballx, brgltd, bulej93, c3phas, ch0bu, dharma09, djxploit, durianSausage, easy_peasy, fatherOfBlocks, gianganhnguyen, gogo, imare, leosathya, lucacez, martin, oyc_109, pauliax, peiw, prasantgupta52, ret2basic, rfa, robee, sikorico, simon135, tofunmi, volky, wagmi, zishansami
45.4713 USDC - $45.47
createBid(uint256 _tokenId)
ā File: src/auction/Auction.sol āāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā 90 ā function createBid(uint256 _tokenId) external payable nonReentrant { 91 ā // Get a copy of the current auction 92 ā Auction memory _auction = auction; + settings memory _settings = settings; 93 ā 94 ā // Ensure the bid is for the current token 95 ā if (_auction.tokenId != _tokenId) revert INVALID_TOKEN_ID(); 96 ā 97 ā // Ensure the auction is still active 98 ā if (block.timestamp >= _auction.endTime) revert AUCTION_OVER(); 99 ā 100 ā // Cache the address of the highest bidder 101 ā address highestBidder = _auction.highestBidder; 102 ā 103 ā // If this is the first bid: 104 ā if (highestBidder == address(0)) { 105 ā // Ensure the bid meets the reserve price 106 +ā if (msg.value < _settings.reservePrice) revert RESERVE_PRICE_NOT_MET(); 107 ā 108 ā // Else this is a subsequent bid: 109 ā } else { 110 ā // Cache the highest bid 111 ā uint256 highestBid = _auction.highestBid; 112 ā 113 ā // Used to store the minimum bid required 114 ā uint256 minBid; 115 ā 116 ā // Cannot realistically overflow 117 ā unchecked { 118 ā // Compute the minimum bid 119 ā minBid = highestBid + ((highestBid * _settings.minBidIncrement) / 100); 120 ā } 121 ā 122 ā // Ensure the incoming bid meets the minimum 123 ā if (msg.value < minBid) revert MINIMUM_BID_NOT_MET(); 124 ā 125 ā // Refund the previous bidder 126 ā _handleOutgoingTransfer(highestBidder, highestBid); 127 ā } 129 ā // Store the new highest bid 130 ā auction.highestBid = msg.value; 131 ā 132 ā // Store the new highest bidder 133 ā auction.highestBidder = msg.sender; 134 ā 135 ā // Used to store if the auction will be extended 136 ā bool extend; 137 ā 138 ā // Cannot underflow as `_auction.endTime` is ensured to be greater than the current time above 139 ā unchecked { 140 ā // Compute whether the time remaining is less than the buffer 141 +ā extend = (_auction.endTime - block.timestamp) < _settings.timeBuffer; 142 ā } 143 ā 144 ā // If the time remaining is within the buffer: 145 ā if (extend) { 146 ā // Cannot realistically overflow 147 ā unchecked { 148 ā // Extend the auction by the time buffer 149 +ā auction.endTime = uint40(block.timestamp + _settings.timeBuffer); 150 ā } 151 ā } 152 ā 153 ā emit AuctionBid(_tokenId, msg.sender, msg.value, extend, auction.endTime); 154 ā }
#0 - GalloDaSballo
2022-09-26T20:39:25Z
400