English Auction

English Auction Contract Overview

The EnglishAuction contract implements ascending-price auctions. Each auction is its own contract instance, deployed by the AuctionFactory (as an EIP-1167 minimal-proxy clone of a template) — so every auction holds exactly its own NFT and its own funds, isolated from all others.

The permissions to initiate an auction and participate in bidding are handled through Role-Based Access Control at the application layer.


Lifecycle

  1. Creation — the factory verifies the seller owns the NFT and has approved the factory, then deploys the auction and transfers the NFT into the auction contract (NFT escrow) for the auction's lifetime.
  2. Bidding — bidders send ETH with their bids; each new bid must exceed the current highest bid.
  3. End — after the end time, end() finalizes the auction (it is deliberately callable by anyone, since contracts don't execute on their own). The NFT transfers to the highest bidder; the winning payment stays escrowed in the contract.
  4. Settlement — the buyer's confirmDelivery() releases payment to the seller. If the buyer never confirms, the seller may withdraw after a 7-day grace period, so funds can never be locked forever.

Properties

An auction has these properties:

PropertyDescription
nft / nftIdThe ERC-721 contract and token being sold (held by the auction).
sellerAddress of the seller who initiated the auction.
highestBidCurrent highest bid amount.
highestBidderAddress of the current highest bidder.
bidsMapping of outbid amounts, reclaimable per bidder (pull pattern).
endAtTimestamp at which the auction ends.
started / endedLifecycle flags.
paymentReleasedWhether escrowed funds have been released to the seller.

Design notes

DecisionRationale
Pull-payment withdrawalsOutbid funds accumulate in bids[bidder] and are reclaimed via withdraw() — safer than pushing refunds, and immune to griefing by contracts that reject transfers.
Permissionless end()Contracts cannot wake themselves up; anyone may finalize an expired auction, so settlement never depends on one party showing up.
Escrowed settlementPayment is released by the buyer's delivery confirmation rather than instantly — appropriate for physical goods. A 7-day CONFIRMATION_GRACE_PERIOD lets the seller withdraw if the buyer disappears.
Reentrancy guardAll value-moving functions are protected against reentrancy.

Actions

ActionDescriptionWho
create auctionFactory clones the contract and escrows the NFTseller (via app)
bidPlace a bid above the current highest, sending ETHany non-seller
withdrawReclaim funds after being outbidoutbid bidders
endFinalize after endAt; NFT → winner, funds → escrowanyone
confirmDeliveryRelease escrowed payment to the sellerwinning buyer
sellerWithdrawCollect payment after the 7-day grace periodseller