DEX router contract: What happens in a swap
A router contract in a DEX swap takes your tokens, routes them through pools, checks the minimum output and sends you the result—or reverts in one transaction.
The Chain Times Desk3 min read

A DEX router contract is the smart contract you send a swap to; it moves your tokens through liquidity pools, checks the minimum output and sends you the result or reverts the trade.
A liquidity pool is where tokens are held for trading. The pool provides liquidity, while the router handles the route and the swap instructions. That lets you trade through one or more pools without calling each pool yourself.
How does a router handle a DEX swap?
A router receives the input token and amount, the route, the minimum output and often a deadline. It then pulls the approved tokens, calls pools in order and checks the output before sending tokens to your wallet.
Take a USDC→WETH→LINK swap. The router sends USDC to the first pool, which returns WETH. It sends that WETH to the second pool, which returns LINK. Both pool trades happen within one transaction, so the route either completes as a whole or reverts.
Uniswap V2’s Router02 shows this pattern in functions such as swapExactTokensForTokens. Its instructions include a path, a minimum output called amountOutMin, and a deadline. Those details come from the Uniswap V2 documentation.
Compare two swaps with the same tokens, route and deadline. In one, the pools return at least the minimum LINK requested, so the router can finish and send it to you. In the other, the output is below that minimum, so the router reverts the swap. A passed deadline also causes a revert. In either case, a revert cancels the swap as a whole.
An aggregator router can use pools from several DEXs and split a trade across them. KyberSwap’s MetaAggregationRouterV2 executes aggregator swaps, according to its contract-address documentation. The transaction’s spender is the router address; the route can involve multiple liquidity sources.
KyberSwap’s aggregator can make fees part of the swap decision. The kyberswap fees page explains the fees to consider when using KyberSwap. In your wallet, the approval screen names the router as the spender, while the transaction details show the contract being called.
Before approving, compare the spender address with the router address in the aggregator’s docs. You can also inspect the transaction on Etherscan to see which contract received the call. An approval lets that spender use the approved token amount for the swap; it is separate from the trade itself.
What else should you know about DEX swaps?
Why do I have to approve a token before swapping?
A token approval lets the router move your tokens from your wallet into the swap. The approval screen’s spender address identifies which contract gets that permission, so confirm it matches the router listed in the aggregator’s documentation.
What is the difference between a DEX and a DEX aggregator?
A DEX is a place to trade through its liquidity pools. An aggregator searches routes across supported liquidity sources, then its router executes the selected route. The router matters because it is the contract that applies the instructions and output check on-chain.
In short, the router connects your swap instructions to the pools and enforces the minimum output and deadline. Recognising its spender address helps you understand what your approval authorises and which contract your swap calls.