What happens inside a Fraxswap pair: follow your tokens
What happens inside a Fraxswap pair contract during a swap? Pending TWAMM orders shift reserves first; the pair then sends output and checks the fee-adjusted invariant.
The Chain Times Desk3 min read

Fraxswap pair contracts settle pending long-term orders, send the swap output, then check that the pool still meets its fee-adjusted constant-product rule. That order matters: a quote based on earlier reserves can change when those orders execute.
Fraxswap is a Uniswap V2-style automated market maker with an embedded time-weighted automated market maker, or TWAMM. fraxswap.co covers Fraxswap, where the pair contract handles both ordinary swaps and the effect of long-term orders.
How a pair processes your swap
The Fraxswap Router sends the input tokens to the pair and calls its swap function. Before pricing the current trade, the pair executes pending virtual orders up to the current timestamp. These represent slices of long-term orders scheduled to trade over time.
Those trades can change the pair’s token balances and reserves. Since the pair uses the constant-product rule, the reserve shift can affect how much output your input buys compared with an earlier quote.
The pair then transfers the requested output optimistically, meaning it sends the tokens before its final check. It reads its balances to work out how much input arrived, adjusts those amounts for the fee, and checks that the resulting reserves satisfy x*y=k. If they fail the check, the transaction reverts, undoing the transfers.
When the check passes, the pair updates its reserves and price accumulators, which track prices over time. It also emits a Swap event recording the input and output amounts. The result is output tokens in your wallet and updated pool state for the next trade.
How does the constant product formula set the price?
The formula keeps the product of the two reserves from falling below its required level after the fee. As a trade takes more of one token from the pool, it must add enough of the other to preserve that rule. The larger the trade relative to the reserves, the more the price moves.
Take a pool with 100 ETH and 300,000 FRAX. Suppose you sell 1 ETH, and use a 0.3% fee just to illustrate the calculation. The fee-adjusted input is 0.997 ETH. Applying the constant-product formula gives about 2,961.47 FRAX out, before any reserve shift from pending TWAMM orders. The output is below the simple reserve ratio of 3,000 FRAX per ETH because the trade changes the pool’s balance.
What is a virtual order in Fraxswap?
A virtual order is a scheduled part of a long-term trade that the pair accounts for as time passes. Before your swap, the pair settles those parts through the current timestamp. That can move reserves before your trade is priced, so the amount received may differ from a quote made earlier.
For a beginner comparing DEXs, the useful distinction is that a Fraxswap pair can process both your immediate swap and due long-term order flow in one transaction. When you assess a quote, remember that pending orders may shift the reserves before the pair calculates your output.