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
- 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.
- 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. - 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.
- 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:
| Property | Description |
|---|---|
| nft / nftId | The ERC-721 contract and token being sold (held by the auction). |
| seller | Address of the seller who initiated the auction. |
| startingPrice | Price at the moment the auction starts. |
| discountRate | Price decrease per second (wei/second). |
| startAt / expiresAt | Auction start time and expiry. |
| buyer | Address of the winning buyer (set on purchase). |
| paymentReleased | Whether escrowed funds have been released to the seller. |
Design notes
| Decision | Rationale |
|---|---|
| On-chain price function | getPrice() 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 validation | The factory requires startingPrice ≥ discountRate × duration, so the price can never decay below zero within the auction window. |
| Instant, atomic purchase | A single buy() transaction transfers the NFT, records the buyer, and refunds any overpayment — no separate claim step. |
| Escrowed settlement | Same as the English auction: buyer confirmation releases funds; a 7-day grace period protects the seller from an unresponsive buyer. |
Actions
| Action | Description | Who |
|---|---|---|
| create auction | Factory clones the contract and escrows the NFT | seller (via app) |
| buy | Purchase at the current computed price | any non-seller |
| confirmDelivery | Release escrowed payment to the seller | buyer |
| sellerWithdraw | Collect payment after the 7-day grace period | seller |