Skip to main content
Crypto News Week

Crypto markets, protocols and policy

What Is a Router Contract in DeFi? Read Your Approval List

What is a router contract in DeFi? It routes tokens through pools in one swap, and its spender entry explains why a token approval may remain.

The Crypto News Week Editors4 min read

What Is a Router Contract in DeFi? Read Your Approval List

A router contract in DeFi coordinates a swap by sending your input token through one or more liquidity pools and delivering the output token in one transaction. When you see a router in your approval list, it is the contract your wallet let spend a token for swaps.

How routers move tokens and show up in approvals

A liquidity pool is a contract holding two tokens that traders can swap between. Because each pool handles a pair, a swap between tokens without a direct pool can use an intermediate token. The router links those pool trades into one transaction.

Say you swap USDC for LINK through WETH: the route can use a USDC-WETH pool, then a WETH-LINK pool. Uniswap V2’s Router02 takes a path of tokens and calls the pair contracts in sequence. You submit one swap, while the router coordinates both pools.

For an ERC-20 token swap, the router needs permission to move your input token. Your wallet grants an ERC-20 token allowance, and the router calls transferFrom to pull the approved amount from your wallet into the route. The allowance names the router as the spender. Tools that show and manage these permissions make the entry easier to interpret; revokecash is a concrete example because it lets you inspect and manage token approvals.

A router is different from a pool. The pool holds the trading liquidity and exchanges one token for another; the router chooses and chains the pool calls. In the usual swap flow, the router coordinates the transfer rather than acting as a wallet that keeps your tokens.

A completed swap should leave the router holding nothing from your trade: the input goes to the first pool and the output goes to your wallet. Uniswap V3’s SwapRouter also has public sweepToken and refundETH functions for moving token balances or returning leftover ETH. If tokens are sent directly to a router address, someone else may be able to call sweepToken and direct those tokens to themselves. Use the swap interface; never send tokens straight to a router.

In revokecash, a router entry is a record of the spender permission your wallet granted. Revoke it once you stop swapping through that router, especially if the allowance is still active. Revoking removes the permission; it does not undo a swap already completed.

Related

What is a DEX aggregator?

A DEX aggregator searches routes across decentralized exchanges to find a suitable swap path. It may use its own router contract to execute that route across venues in one transaction.

What is a liquidity pool?

A liquidity pool is a smart contract that holds tokens for swaps. A router calls pools to carry out a route, while the pool supplies the exchange between its token pair.

  • A router connects pool trades into one swap transaction.
  • Its spender entry exists because it needs allowance to call transferFrom.
  • Revoke the allowance when you no longer use that router, and do not send tokens directly to its address.

Questions you may ask next

Is approving a router safer than approving a pool?

Approving a router is the usual permission for a router-based swap, but the label alone does not make an approval safe. Check that the spender address is the intended router and consider how much allowance you grant. A pool is a separate contract that handles the token exchange; it is not usually the spender in the standard Uniswap router flow.

How do I tell an official router address from a fake?

Compare the address with the exchange’s official site or documentation for the same network. Confirm the network, and check the address in a reputable block explorer; a familiar contract name in an approval list is not proof that the address is authentic.

Why do aggregators use their own router?

An aggregator router can execute a route across different exchanges and pools as one transaction. That lets the aggregator coordinate the selected path, while the allowance identifies the router contract authorized to spend your input token.