---
title: "AIMM at a glance"
description: "How BTR pools price swaps from external marks, local inventory and coverage instead of a fixed bonding curve."
date: "2026-07-10"
tags: [amm, aimm, inventory]
category: "protocol"
status: published
lang: en
motion: depth
authors: [jake]
og: "/thumbnails/depth-og-poster.png"
---

Constant-product pools price from a fixed curve and let the *trade* move the price. BTR pools do the opposite: an external reference price anchors the quote, and the pool's own state decides how far trading can push it.

## The three inputs

- **Mark** - the external reference price. NX Rates keepers sign marks off-chain and push them on-chain (the [oracle page](/oracle) lets you verify one end-to-end). Past its TTL a feed fails closed: reads revert `StaleData` and the asset freezes rather than quote off a stale anchor ([depeg halt](/docs/3-2-1-flow-guards)). Same-asset withdrawals are not feed-gated, so a dead keeper cannot trap you in the asset you deposited.
- **Inventory** - what the pool actually holds per asset. When inventory drifts from target allocation, the mid skews and spreads widen so flow that restores balance gets the better side.
- **[Coverage](/docs/glossary#coverage-ratio)** - reserves divided by liabilities on a leg. 100% means the pool holds exactly what LPs are owed; coverage shortfalls feed straight into pricing, which is how BTR does impermanent-loss protection without a separate insurance fund.

## What the quote is made of

Not weighted heuristics: three additive terms in one spread, each charged for a
different risk:

$$S \;=\; \underbrace{\textstyle\sum_i f_{\min,i} + \tfrac{\sigma_p\,\nu_p}{100\cdot\text{BPS}}}_{\text{vol}}
\;+\; \underbrace{\textstyle\sum_i \tfrac{z\,\sigma_i\sqrt{\tau_i}}{\text{BPS}}}_{\text{stale}}
\;+\; \underbrace{\big(\textstyle\sum_i u_i\big)\cdot\tfrac{B}{\text{BPS}}}_{\text{conf}}$$

| term | charges for | driven by |
|---|---|---|
| volatility | how fast the asset moves | path sigma $\sigma_p$, endpoint vega $\nu_p$ |
| staleness | how old the mark is | age past grace $\tau_i$, per leg |
| confidence | how sure the feed is | each leg's reported 1σ interval $u_i$ |

The two constants are fixed, not dials: $z=472$ scales the staleness term, and $B/\text{BPS}$ is the pbps-to-bps conversion on the confidence term.

Two details matter more than the algebra. Staleness is summed **per leg**, not
coupled across the path: one keeper feeds several spokes, so an outage stales
them together, and charging one aggregate age would under-charge two equally
stale legs by 29%. And a path inherits *every* leg's confidence, not the worst
one, so a quiet leg beside a noisy one still pays its own.

Full derivation, integer arithmetic and clamps in
[spread & fees](/docs/1-1-4-spread-fees).

## Why not just x·y=k

A fixed curve pays arbitrageurs out of LP pockets every time the market moves ([LVR](/docs/glossary#lvr-loss-versus-rebalancing)). Anchoring to a keeper mark means the pool re-prices *before* arbitrage arrives, so the spread compensates flow that takes real inventory risk instead of subsidizing flow that takes none.

| design | prices from | re-prices when | who pays the move |
|---|---|---|---|
| constant product | its own reserves | someone trades | the LP |
| concentrated range | a range set by hand | someone trades, inside the range | the LP |
| **AIMM** | **a signed external mark** | **the mark moves, same block** | **whoever takes the stale side** |

## Per-asset oracle modes

- **EXTERNAL** (recommended) - any `IOracle` mark: NX Rates push, Chainlink adapter, Uniswap/vault reader, custom on-chain discovery.
- **INTERNAL** - cash-collateral 1.0 peg helper only. Mix allowed; prefer EXTERNAL.

## Routing

One pool holds many assets. Each anchors to a correlated parent, not necessarily the base, and a swap prices along the unique tree path between its two endpoints via their lowest common ancestor. Depth is capped at 4, so a path spans at most 9 nodes and 8 legs.

```mermaid
graph TD
    WBTC[WBTC base]
    WBTC --> WETH
    WBTC --> USDC
    WETH --> stETH
    WETH --> weETH
    USDC --> USDT
    USDC --> DAI
    USDT --> USDe
    USDe --> sUSDe
```

Two assets sharing a parent trade through that parent: `stETH` to `weETH` is two legs via `WETH`, never touching the base. Everything settles inside the one pool, so there is no cross-pool hop and no aggregator leg. Each leg still charges its own fee floor, so a two-leg path pays both.

## Next

[Spread & fees](/docs/1-1-4-spread-fees) carries the formal parameter surface; [inventory management](/docs/1-1-1-inventory-management) shows how drift maps to quote skew.
