Skip to content
log(swap)

Protocol

The architecture, and how the mathematics is actually implemented.

The protocol implements the log invariant in two pool managers.

Pool types

A C-pool gives each position its own floor and optional cap. An F-pool shares its floor, composition and any generation cap across holders, and supports multiple base assets.

  • The two pools — the fork, and the two answers: the F-pool (fungible) and the C-pool (concentrated).
  • Architecture — what both are built out of: four contracts, the state layout and the ladder, the fee machinery as shipped, settlement, and the numerics and verification.

The shape in one paragraph

Every market lives inside one of two singleton contracts. ManagerC holds every concentrated market — pools[poolId], a tick ladder per market, and a single flash-accounting lock spanning all of them. ManagerF does the same for every fungible pool. A market is not a deployment: it is a key — an economic tuple — whose hash is its identity, created by calling initialize. The key travels in calldata on every operation and is verified against that hash, so per-market parameters never occupy storage. Each singleton has its own router and its own read-only lens. Six core contracts, plus the policies F-pools are born under and the registry that approves them.

What an institution can write down

The objects that make the pool work are the objects a liquidity agreement is written against, so the terms and the state are the same thing:

  • Private pools and controlled access. An F-pool has an authority — a key or a governance contract — that owns the floor, and a policy, named in the pool key, that bounds what the authority may do: on a pad, a harvest of income only; on a private pool, gates and lists of who may trade. Every economic field lives in the pool key and is verified against its hash on each operation, so it is not merely hard to change for the life of the market: it cannot be.
  • Protocol-owned liquidity, in the open. Raising the floor at unchanged LL and xx releases pure quote — price does not move, liquidity does not change, no base is sold — so a treasury's position and its withdrawals are arithmetic on state rather than a report.
  • SLA/KPI parameters, read rather than attested. Liquidity committed is LL; the band is the position's floor and cap; the fee is fixed in the key; income is L ΔFL\,\Delta F and the risk borne is 12L ΔΣ\tfrac12 L\,\Delta\Sigma. Both are statistics of the same log⁡p\log p path, so the realized outturn is one subtraction — no oracle, no benchmark portfolio, no model.

What is deliberately not here

The packaging is Uniswap v4's — singleton, calldata key, global flash accounting, ERC-6909 claims — adopted for two structural dividends: one bytecode budget for the whole protocol, and cross-market netting. What v4's generality costs, this design declines:

  • No hooks. One opinionated fee model is built in; there is no extension point, and therefore no arbitrary code between swap steps.
  • No two-sided ranges. The primitive is a floored position; a capped position is the difference of two floors on one signed ladder.
  • No two-token fee growth. Quote-only is the unique convention under which the accumulator equals ϕ TV(log⁡p)\phi\,\mathrm{TV}(\log p).
  • Fixed market fees. Fee rates are chosen at creation; admission policies can restrict the tiers.
  • No native ETH yet. ERC-20 only; the singleton makes a currency abstraction addable later — one contract to teach rather than NN — which is why it was deferred rather than designed around.