Dutch Auction

Dutch Auction Contract Overview

The DutchAuction contract implements descending-price auctions: the price starts high and falls linearly over time until a buyer accepts it. Like the English auction, each Dutch auction is its own contract instance deployed by the AuctionFactory as a minimal-proxy clone, holding its own NFT and funds in isolation.


Lifecycle

  1. Creation — the factory verifies ownership and approval, deploys the auction, and transfers the NFT into the auction contract. The seller sets a starting price and a discount rate.
  2. Price decay — the live price is computed on-chain: price = startingPrice − discountRate × secondsElapsed (floored at zero). Nothing ticks in the background; the price is simply a function of time.
  3. Buy — the first buyer to send at least the current price wins instantly. The NFT transfers immediately and any overpayment is refunded in the same transaction.
  4. Settlement — the payment stays escrowed in the contract until the buyer confirms delivery, or the seller withdraws after the 7-day grace period.

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.
startingPricePrice at the moment the auction starts.
discountRatePrice decrease per second (wei/second).
startAt / expiresAtAuction start time and expiry.
buyerAddress of the winning buyer (set on purchase).
paymentReleasedWhether escrowed funds have been released to the seller.

Design notes

DecisionRationale
On-chain price functiongetPrice() derives the current price from elapsed time — deterministic, gas-free to read, and impossible to manipulate. The UI recomputes the same function client-side for a live countdown display.
Creation-time validationThe factory requires startingPrice ≥ discountRate × duration, so the price can never decay below zero within the auction window.
Instant, atomic purchaseA single buy() transaction transfers the NFT, records the buyer, and refunds any overpayment — no separate claim step.
Escrowed settlementSame as the English auction: buyer confirmation releases funds; a 7-day grace period protects the seller from an unresponsive buyer.

Actions

ActionDescriptionWho
create auctionFactory clones the contract and escrows the NFTseller (via app)
buyPurchase at the current computed priceany non-seller
confirmDeliveryRelease escrowed payment to the sellerbuyer
sellerWithdrawCollect payment after the 7-day grace periodseller