Crypto glossary

On-chain limit orders and TWAP

Definition

On-chain limit orders and TWAP orders let DEX users set a target price or split a trade over time, with keepers or solvers filling it when conditions are met.

A basic AMM swap executes immediately at the pool price. To trade at a chosen price, users sign an order off-chain stating the tokens, amount and limit, and keep custody of their funds until it is filled. Keepers, solvers or market makers watch the order and execute it on-chain once the price is reachable. A TWAP order splits a large trade into smaller parts executed at regular intervals.

Aggregators such as CoW Swap, 1inch and Jupiter offer these order types, and some AMMs with hooks or order-book DEXs support them natively. They give DeFi traders tools that used to require a centralised exchange, and TWAPs are popular with DAOs that need to sell treasury tokens without moving the market too much.

Execution is not guaranteed: a price may touch the limit without enough liquidity, and fillers need a profit margin, so orders near the market price can wait. Signed orders remain valid until they expire or are cancelled, and cancelling may cost gas. Fees, slippage and gas still apply to each TWAP slice.

Example

A trader signs an order to sell 5 ETH if the price reaches 4,000 USDC; days later a solver fills it on-chain and the USDC lands in the trader's wallet.

Related terms