Skip to content

Commit

Permalink
ah2: minor rename
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrai committed Oct 5, 2023
1 parent f677583 commit ff650bc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/nouns-contracts/contracts/NounsAuctionHouseV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,32 +121,32 @@ contract NounsAuctionHouseV2 is
* @dev This contract only accepts payment in ETH.
*/
function createBid(uint256 nounId) external payable override {
INounsAuctionHouseV2.AuctionV2 memory auction_ = _auction;
INounsAuctionHouseV2.AuctionV2 memory auctionCache = _auction;

if (auction_.nounId != nounId) revert NounNotUpForAuction();
if (block.timestamp >= auction_.endTime) revert AuctionExpired();
if (auctionCache.nounId != nounId) revert NounNotUpForAuction();
if (block.timestamp >= auctionCache.endTime) revert AuctionExpired();
if (msg.value < reservePrice) revert MustSendAtLeastReservePrice();
if (msg.value < auction_.amount + ((auction_.amount * minBidIncrementPercentage) / 100))
if (msg.value < auctionCache.amount + ((auctionCache.amount * minBidIncrementPercentage) / 100))
revert BidDifferenceMustBeGreaterThanMinBidIncrement();

_auction.amount = uint128(msg.value);
_auction.bidder = payable(msg.sender);

// Extend the auction if the bid was received within `timeBuffer` of the auction end time
bool extended = auction_.endTime - block.timestamp < timeBuffer;
bool extended = auctionCache.endTime - block.timestamp < timeBuffer;

emit AuctionBid(auction_.nounId, msg.sender, msg.value, extended);
emit AuctionBid(auctionCache.nounId, msg.sender, msg.value, extended);

if (extended) {
_auction.endTime = auction_.endTime = uint40(block.timestamp + timeBuffer);
emit AuctionExtended(auction_.nounId, auction_.endTime);
_auction.endTime = auctionCache.endTime = uint40(block.timestamp + timeBuffer);
emit AuctionExtended(auctionCache.nounId, auctionCache.endTime);
}

address payable lastBidder = auction_.bidder;
address payable lastBidder = auctionCache.bidder;

// Refund the last bidder, if applicable
if (lastBidder != address(0)) {
_safeTransferETHWithFallback(lastBidder, auction_.amount);
_safeTransferETHWithFallback(lastBidder, auctionCache.amount);
}
}

Expand Down

0 comments on commit ff650bc

Please sign in to comment.