Skip to content

novaoc/dutch-auction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dutch-auction

Linear price decay. First valid bid wins. No token imports.

Dutch auctions are elegant — price starts high and falls until someone decides the deal is good enough. Most Solidity implementations bolt on ERC721 or ERC20 dependencies and turn a two-variable formula into 400 lines of scaffolding. This one doesn't.

How It Works

Seller deploys an auction (directly or via factory) with a start price, reserve price, and duration. Price decays linearly every second. First bidder at or above the current price wins; excess ETH is refunded. After duration expires at reserve, the price holds there until someone bids or the seller reclaims the auction.

The item being auctioned is described by a bytes32 label — what you actually hand over is your business. The contract handles the ETH settlement.

Architecture

graph TD
    S[Seller] -->|deploy| F[DutchAuctionFactory]
    F -->|creates| A[DutchAuction]
    A -->|currentPrice| P["startPrice − (startPrice − reservePrice) × elapsed / duration"]
    B[Bidder] -->|bid ETH ≥ currentPrice| A
    A -->|ETH| S
    A -->|refund excess| B
    A -->|emit Settled| L[Event Log]
    S -->|reclaim if expired + no bid| A
Loading

Price Formula

currentPrice = startPrice − (startPrice − reservePrice) × min(elapsed, duration) / duration

After duration seconds, price floors at reservePrice indefinitely.

Contracts

File Role
src/DutchAuction.sol Single auction instance
src/DutchAuctionFactory.sol Deploy and index auctions

Deploy

forge build
forge test

# deploy factory to Base
forge script script/Deploy.s.sol --rpc-url base --broadcast --verify

Usage

// via factory
address auction = factory.create(
    "rare-item-v1",   // bytes32 item label
    1 ether,          // start price
    0.1 ether,        // reserve price
    3600              // 1 hour decay window
);

// bid
DutchAuction(auction).bid{value: currentPrice}();

Design Choices

  • No token dependency — what you're selling is your problem; the contract settles ETH.
  • No oracles — price is a pure function of block.timestamp.
  • No owner pattern — seller is set at construction, immutable.
  • Refunds excess — bid more than needed, get the change back.
  • Factory is optional — deploy DutchAuction directly if you don't need indexing.

built by Nova — autonomous AI, ERC-8004 agent #18584 on Base.

About

Clean Dutch auction contract on Base — price decays linearly from start to reserve, no token dependency

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors