The Engines · Ch. 12
vAMM Perps
There is no book to fill and no maker to wait for. You trade against a formula. You buy, and a price you never negotiated climbs a curve that was never holding a single coin.
The Idea
Intuition
Last chapter ended on the orderbook’s one weakness: it needs makers, and an empty book is a dead market. The vAMM is the fix. Instead of matching you against a person, it prices you off a curve.
The curve is constant product. Picture a pool of two reserves, say ETH and USDC, whose product is held at a fixed number . The price is nothing more than their ratio, USDC per ETH. That is the whole engine.
It is virtual because no real ETH or USDC sits in that pool. The reserves are numbers the protocol picks to decide how deep the market should feel. Your actual money is margin, held off to the side. The curve only sets the price and how far each trade moves it.
Buy, and you pull ETH off the curve and push USDC on. The product has to stay at , so as the ETH reserve falls the ratio rises: the price goes up. Sell, and it runs the other way. The curve quotes both sides from the market’s first second, with nobody posting anything. No makers, no cold start.
The cost is built in. Price moves against you as you trade, and with only virtual depth behind it, a big order moves it hard. That is the curve’s shape doing the work. And since there is no pool of real coins for arbitrageurs to rebalance, funding (Chapter 6) is what tethers this price back toward spot. Watch the dot ride up the curve, then send a bigger order.
The Math
How It’s Calculated
In plain terms: the two reserves multiply to a fixed number, the price is their ratio, and any trade slides you along the curve to a new ratio. The further you slide, the worse your average price.
The pool holds virtual reserves (ETH) and (USDC), pinned to an invariant:
The quoted price is just the ratio of the reserves:
Buy of ETH and the reserves must stay on the curve, so the new ETH reserve is and the USDC you pay is whatever keeps the product at :
Your average fill is , always worse than the price you started at, and the gap widens as grows relative to the reserves. That gap is the slippage from Chapter 2, except here it is not a stack of orders. It is the curvature of a single equation.
War Story
I built one of these once. The funding rate is what killed it.
On a vAMM the mark is wherever the curve sits, so the instant anyone trades, the price moves and funding starts pulling. That is fine when there is a crowd on both sides and market makers arbitraging the mark back toward the index. It is a disaster when there is not. With nobody stepping in to balance the two, the mark just sat skewed away from the index, funding ran hot the whole time, and with no trader on the other side to pay it, the bill came out of the insurance fund.
The knob that is supposed to save you is the initial virtual liquidity, and it is a trap either way. Set it high and a trade barely moves the price, which sounds great until the entire crowd stacks onto one side at a mark that will not correct, and the protocol wears the losses. Set it low and every ordinary order swings the price so hard the market is unusable. There is a narrow band in between, and it drifts with volume and with the crowd’s mood, so the number that worked last week is wrong this week.
We tuned it, and retuned it, and the mark kept pulling away from the index because the market makers we were counting on never showed up to close the gap. Eventually we shut it down. The whole engine assumed someone would always arbitrage it back to fair, and when no one did, there was nothing left holding the price to reality.
Field note: building a vAMM perp
Note
A pure vAMM is elegant and fragile in the same breath. The price rests on numbers, not capital, so it can be shoved around, and there is no real inventory actually taking the other side of your trade. That is why almost nobody runs a bare vAMM today. The designs that stuck bolt the curve to an oracle for its price and a funded pool for the counterparty. Those are the next two chapters.