Skip to content

How does Fraxswap work? Pool pricing and TWAMM orders

Fraxswap is a decentralized exchange that lets you swap tokens against a two-token pool or spread a large trade over time. With Fraxswap, your execution price comes from the pool’s reserves rather than a matching order in an order book, so trade size affects what you pay. Its constant-product rule, x*y=k, changes the price as those reserves change. The Fraxswap TWAMM divides a long-term order into virtual trades, giving the pool and other traders time to respond between portions of the order.

Pool reserves set the price of each trade

On an order-book exchange, your market order fills against other traders’ offers. In a Fraxswap pair, the pool is your counterparty. A liquidity provider deposits both tokens into a Fraxswap pair contract, creating reserves that traders can swap against.

The pair follows the constant-product design inherited from Uniswap V2. If x and y are its two token reserves, a swap changes their amounts while preserving their product before fees. The Frax Finance technical details identify this rule as the exchange’s core AMM and explain how long-term orders interact with it.

Take an illustrative pool holding 100 ETH and 300,000 USDC. Its starting price is 3,000 USDC per ETH. To buy 10 ETH at once, you leave 90 ETH in the pool. Keeping the product at 30 million requires about 333,333 USDC in the pool afterward, so you pay about 33,333 USDC before fees. Your average price is about 3,333 USDC per ETH, even though the starting price was 3,000.

That gap is price impact: your own purchase removes ETH and adds USDC, raising the price as it fills. The larger the trade relative to available reserves, the more the reserves shift. A deeper pool absorbs the same trade with less movement. For an immediate swap, compare the quoted output with the pool’s starting price and account for fees before deciding whether that impact suits your trade.

A long-term order uses the same pool differently. You commit the token to sell and choose a duration; the TWAMM assigns it an even selling rate over that period. Virtual sub-orders trade against the pool as blocks pass. The contract calculates their accumulated effect when someone next interacts with the pair, so each virtual trade needs no separate transaction.

Suppose you spread that illustrative ETH purchase over time. Each portion still changes the pool’s reserves, but other traders can act before later portions execute. If the purchases make ETH expensive in the pool relative to other markets, arbitrageurs can buy ETH elsewhere and sell it into the pool for USDC. Their trades replenish its ETH reserve and push its price back toward the wider market. If a long-term order sells ETH instead, arbitrage can work in the opposite direction.

This response is central to a TWAMM order. Spreading a trade gives arbitrageurs repeated opportunities to correct a price difference rather than leaving the whole order to move one pool at once. Whether they trade depends on the difference being large enough to cover their costs. The long-term order therefore receives prices along its execution path, which can change as the wider market moves.

What is a TWAMM?

A time-weighted average market maker, or TWAMM, is a mechanism for executing a long-term order through an AMM at a steady rate. Paradigm’s 2021 TWAMM research describes the virtual orders and the arbitrage that brings the embedded pool’s price back toward other markets. Use the distinction when timing matters: an immediate swap takes the pool price available now, while a long-term order takes prices across its chosen duration.

Why does price impact grow with trade size?

Price impact grows because each unit you buy leaves less of that token in the pool and more of the token you paid. Under x*y=k, the next unit costs more than the last. Compare your intended trade with the pair’s reserves to judge how much of that price movement you would cause.

Fraxswap replaces order matching with reserve-based pricing. The deciding question is how much your trade moves those reserves: use the immediate quote to assess a swap, or consider a long-term order when spreading a large trade lets the pool’s price adjust between portions.