Skip to content
Solana

Learn

What is an AMM?

How a pool prices every swap from the two balances it holds, why the price moves as you trade, and where the fees go.

Last reviewed · All explainers

An order book or a pool

An order book matches a buyer with sellers who left orders at set prices. If nobody is selling near your price, nothing fills.

An automated market maker (AMM) works without waiting for the other side. A pool holds two tokens, and a formula prices every swap from those two balances. You trade against the pool, at any time, and the price moves with your trade.

On Solana a pool is a program account that records the terms and the balances, plus one token account per side, called a vault. On reel every vault is owned by one program address, VAULT_AUTH, so only the program's own rules can move what is in it.

The constant-product curve

Most AMMs keep the product of the two balances constant: x · y = k. Buying one token takes it out of the pool and puts the other in, so the token you buy gets scarcer and its price rises.

reel's pools use this curve, written rb · eq = k. rb is the pool's base token (the token being traded) and eq is its quote side (SOL, USDC or another quote). The price is eq / rb: quote per base.

Sample numbers, not live data. A pool holds 1,000,000 TOKEN against 100 SOL, so 1 TOKEN costs 0.0001 SOL. A buy that puts 1 SOL in gets 1,000,000 × 1 / 101 ≈ 9,901 TOKEN out. The pool now holds about 990,099 TOKEN and 101 SOL, so the price is about 0.000102 SOL: roughly 2% higher. The buyer paid an average of about 0.000101 SOL each.

That gap between the starting price and what you actually pay is price impact. It shrinks as the pool gets deeper: the same 1 SOL in a pool ten times larger moves the price about a tenth as much.

Opening with only the token

A new token has no quote side yet. reel lets a pool open with the token alone by adding a virtual quote to the quote side of the curve: eq = reserve_quote + virtual_quote. The virtual amount sets the opening price, and real quote comes in as people buy.

Virtual quote can never be withdrawn, and a sell can only take out quote the pool really holds. If a sell would need more than the real quote reserve, it fails with InsufficientLiquidity. So the vaults always cover what the pool owes, whatever the virtual amount.

Fees and who earns them

Every swap pays the pool's base LP fee, 0.3% by default, and all of it goes to the pool's liquidity providers (LPs). reel never takes any of it.

On many AMMs fees stay inside the reserves. reel keeps them out: each fee adds to a running "fee growth per share" figure, and each LP position collects its part whenever it likes, without touching the deposit. The curve only ever sees the tracked reserves, so tokens sent straight to a vault change nothing.

Fees round up and curve outputs round down, so the trader pays the last unit of dust, never the pool. A pool can also carry Hook Blocks that add charges on top of the base fee; each block's page says who is paid.

Sample numbers, not live data. With a 0.3% base fee, the 1 SOL buy above pays 0.003 SOL to LPs, and 0.997 SOL goes through the curve for about 9,872 TOKEN.

Full range or concentrated

Some AMMs let LPs place liquidity in a price range (concentrated liquidity). That gives more depth near the current price for the same capital, but a position stops earning when the price leaves its range and has to be managed.

reel's pools are full range. Every position covers every price, earns on every swap and never falls out of range. The trade-off is less depth near the price for the same deposit, so price impact is higher than on a well-managed concentrated pool of the same size.

Where reel fits

A reel pool is a full-range constant-product pool plus the Hook Blocks its creator chose when it opened. The blocks are frozen into the pool for good: they decide what a swap pays, who may trade and when, and where each fee goes. The curve underneath stays the same plain formula.