LibraryMarkets2021Design paperCorpus record
The Time-Weighted Average Market Maker
TWAMM. Dave White and Dan Robinson.
Execute a large order as if it were split into infinitely many tiny trades across an interval, without paying gas for each piece. Settlement is lazy. This is an order schedule, not a price oracle, despite the nearby acronym TWAP.
A TWAMM splits a large order into a continuous flow over an interval and settles it lazily against a constant-product pool, so the trader does not send a transaction for every slice.
The five-minute read
It is an order, not an oracle
The nearby acronym TWAP is a measurement of past prices. A TWAMM is a commitment to sell over time. Using one name for the other inverts the direction of the data.
Lazy does not mean unfinished
The pool does not tick every block. When anyone interacts, the contract catches the virtual order up to the present with a closed form. The result is defined. The reserves on chain may look stale in between.
Impact is reduced only by time and opposite flow
A large order still moves the price. Stretching it out helps if other trades arrive while it runs. If the pool is quiet, the order walks the curve anyway, just in one settlement.
Gas is the practical claim
The user pays to open and close, not per slice. That is why the construction can live on a chain where a thousand small swaps would not.
One action, walked through
- A trader deposits the asset they want to sell and names an interval.
- The order joins the virtual flow of that direction.
- As time passes, the flow is treated as trading continuously against the pool and against the opposite flow.
- The next person who touches the pool updates the lazy state to the current time.
- At the end, the trader withdraws what the flow bought. They can cancel early, on the note's terms, and take what has executed.
The argument, unpacked
The closed form is the invention
Anyone can split an order by hand. The paper's content is executing that split without a transaction per piece, using the mathematics of a constant-product pool plus a constant rate. A hook that simply places ten swaps is not this design.
Stale reserves are a footgun
Integrators who read reserves between updates see a pool that has not yet absorbed the virtual order. A price built on that read is wrong in a way the contract will correct at the next touch. The note has to be read by whoever treats reserves as a live quote.
What has to be true
- The embedded pool is constant-product, or the closed form does not apply. A concentrated-liquidity pool needs a different derivation.
- Someone interacts often enough if the application cannot tolerate stale reserves. The math is defined either way. The readers of storage may not be.
- The order's interval and size are what the user signed. A hook can change the meaning of those fields.
- Cancellation rules are the ones in the contract. The note's early-withdraw behaviour is part of the design, not a default of every fork.
What happened after the paper
TWAMM ideas showed up in research prototypes and as candidate Uniswap v4 hooks. A hook that advertises the name may execute a simpler schedule. The 2021 note is the citation for lazy continuous execution against a constant-product pool. It is not Uniswap's time-weighted oracle, which is a different object in the v2 paper.
What to check before you use the idea
- Is this a schedule to trade, or a report of past prices?
- What pool curve is the closed form written for?
- When are reserves updated, and who updates them?
- What does the trader receive if they cancel halfway?
Terms
- Virtual order
- An order the contract treats as trading continuously, without a transaction at each moment.
- Lazy settlement
- Bringing that virtual trading up to date only when someone next touches the pool.
The problem the paper names
A single swap against a constant-product pool moves the price by the whole size at once. Splitting it by hand costs gas and leaks the schedule. The TWAMM wants the split without the transactions.
What the design proposes
- Users submit long-term orders: sell this much of A for B between two times.
- The pool virtually executes those orders continuously against its reserves.
- Anyone who touches the pool brings the lazy accounting up to date.
How the mechanism is specified
- Between interactions, the closed form of the constant-product curve plus a constant flow can be computed without iterating every block.
- Gas stays on the order of a normal swap, not on the order of the number of slices.
- Price impact falls only if opposite flow, or time, actually absorbs the order. The paper does not cancel impact.
What this page does not treat as proven
- A TWAMM is not Uniswap's time-weighted average price oracle. One is an order. One is a measurement.
- Lazy settlement means the on-chain reserves can be stale until someone transacts. Integrators who read reserves mid-interval have to understand that.
- The note is a design. A hook that claims to be a TWAMM can be a different formula.
Why a venture studio still reads it
If a product says TWAP, ask whether it is reporting a past price or selling an asset over time. Those are opposite directions of data flow.
This is Blockchain Lab's reading of a public design paper. It is not the paper, not a copy of it, and not an offer of tokens, equity, custody or a partnership. Later network behaviour can diverge from the text. Nothing here is investment, legal or technical advice.
Research status: Design paper. Last reviewed: 1 October 2026. This is a reading of a public paper, not investment, legal or security advice.
