# Fair Price

The **clearing price** is the single most important number in a ZAP auction. It is the price every winning bidder pays — no matter how high their stated maximum was. Understanding how it is calculated, and what makes it move, is the key to understanding ZAP.

***

### The floor price

Every auction has a **floor price** — an absolute minimum for the clearing price, fixed before the auction starts and visible to everyone. The clearing price can never go below this level, regardless of how little demand there is.

The floor price serves two purposes:

1. It guarantees the project is never sold below a baseline valuation.
2. It gives bidders a predictable worst-case price going in.

***

### How bids form a demand book

When you place a bid, you specify:

* **How much funding currency** you are committing
* **The maximum price per token** you are willing to pay

Every bid sits at a specific price level. Think of it as stacking bids in rows — everyone at $0.01 in one row, everyone at $0.02 in the next, and so on. Together, all these rows form what's called a **demand book**: a picture of who wants tokens and at what price.

The demand book is sorted from highest price to lowest. Bids at higher prices act as stronger demand signals.

***

### What is the clearing price?

The clearing price is the answer to this question:

> **"What is the lowest price at which there is enough demand to purchase the entire available supply?"**

Intuitively: start from the top of the demand book (highest bidders) and work downward. Keep adding demand until you've accumulated enough to buy all the tokens. The price level where you had to stop is the clearing price — and everyone above that level (plus those right at it) wins.

#### The formula

$$\text{Clearing Price} = \frac{\text{Total demand above the clearing price}}{\text{Total token supply}}$$

In other words: if all bidders above the clearing price pooled their funds and divided them equally across all tokens, what price would that produce? That's the clearing price.

Because price can only be a multiple of the **tick spacing** (the smallest allowed price increment), the result is always rounded up to the nearest valid tick.

***

### What forces the price up

The clearing price rises when demand at higher price levels is strong enough to cover the entire supply on its own. Concretely:

> The price jumps to the next tier when the total demand at that tier and above is sufficient to buy all available tokens at that higher price.

Once the price jumps up, bids below the new clearing price are considered **outbid** — they no longer compete for tokens going forward (but they keep any tokens they already earned before being outbid).

#### A simple example

Suppose there are 100 tokens available and the current clearing price is $1.

| Price tier | Demand (in $) | Covers 100 tokens at this price?             |
| ---------- | ------------- | -------------------------------------------- |
| $3         | $400          | Yes — $400 ÷ $3 = 133 tokens worth of demand |
| $2         | $150          | —                                            |
| $1         | $300          | —                                            |

Demand at **$3 and above** = $400. Does $400 cover 100 tokens at $3? Yes ($400 ÷ $3 ≈ 133 ≥ 100). So the clearing price jumps to $3. Bidders at $2 and $1 are outbid.

If only $250 was at $3, then $250 ÷ $3 ≈ 83 tokens — not enough to cover all 100 — and the price would stay lower.

***

### The price can only go up, never down

Once the clearing price reaches a level, it is locked in as a floor. It cannot fall back below any previously reached level. This is enforced by the contract through a **ratchet mechanism**.

This means:

* Bidders who enter early are protected — the price won't retreat and undercut their position
* The price moves reflect genuine, sustained demand

***

### Everyone pays the same price

This is the core promise of a **uniform clearing price auction**.

Even if you placed your bid at a maximum of $5 per token, you do not pay $5 — you pay whatever the final clearing price is. If that clears at $2, you pay $2 for every token you received, and the remaining $3 per token is refunded to you.

You are never punished for bidding a high maximum. Your maximum is simply a ceiling that says *"I'm willing to stay in up to this price."* You will never spend more than you needed to.

***

### Late bids compete fairly with early ones

A subtlety of time-based token release: a bid placed early in the auction competes for the full supply, while a bid placed late only competes for the remaining supply. To ensure late bids are not structurally disadvantaged, their effective demand weight is scaled up proportionally:

> A $100 bid placed when 80% of supply has already been allocated is treated as though it carries $100 × (1 ÷ 20%) = $500 of demand — because it is competing for only 20% of the supply.

This normalization is used purely for determining the clearing price. Your actual spend is still based on your real bid amount, never the inflated figure. It simply ensures the clearing price reflects genuine competition at every point in time.

***

### What you can observe on the UI

| UI element        | What it reflects                                                         |
| ----------------- | ------------------------------------------------------------------------ |
| **Current price** | The live clearing price — what you'd pay per token right now             |
| **Floor price**   | The minimum the price will ever be                                       |
| **Total volume**  | Total funding currency locked in by active bids above the clearing price |

***

> Next: [Failed Auction](https://zealous-auctions.gitbook.io/zealous-auctions-docs/protocol/failed-auction) — what happens when demand doesn't reach the soft cap.
