// Developers

Integration

How to connect RouterX to an existing liquidation or arbitrage system — from contract addresses and approvals to executing a gas-aware route on-chain.

Architecture#

RouterX is composed of three layers. The Router contract is the single entrypoint you call to settle a trade. Behind it, Adapters normalize each DEX into a common swap interface, and the Quoter computes gas-adjusted paths across those adapters.

  • Router — validates the route, pulls input tokens, executes adapter calls, and enforces the minimum output.
  • Adapters — thin, audited wrappers for Uniswap, Curve, Balancer, PancakeSwap, and more.
  • Quoter — an off-chain quoting service and on-chain lens that both return identical, executable routes.

Supported chains#

ChainChain IDStatus
Ethereum1Live
Arbitrum One42161Live
Base8453Live
OP Mainnet10Live
BNB Chain56Live
Polygon PoS137Beta
The router is deployed at the same address across all EVM chains via a deterministic deployer, so you can hardcode a single address in cross-chain systems.

Contract addresses#

The canonical deployment addresses. Always verify against the on-chain source before approving tokens.

ContractAddress
Router0x00000000009726632680FB29d3F7A9734E3010E2
Quoter Lens0x0000000000A39bb272e79075ade125fd351887Ac
Adapter Registry0x0000000000c2d145a2526bD8C716263bFeBe1A72

Integration flow#

Every integration follows the same four steps:

  • Quote — request the best gas-adjusted route for your trade.
  • Approve — grant the Router an allowance for the input token (once per token, or use Permit2).
  • Simulate — confirm the route still executes at the target block.
  • Settle — submit the route calldata to the Router.

Approvals#

The Router pulls the input token via transferFrom, so it needs an ERC-20 allowance. You can either approve the token directly or use Permit2 to sign an off-chain approval and save a transaction.

approve.ts
import { erc20Abi, maxUint256 } from 'viem'

// One-time approval of the Router for WETH
await wallet.writeContract({
  address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
  abi: erc20Abi,
  functionName: 'approve',
  args: ['0x00000000009726632680FB29d3F7A9734E3010E2', maxUint256],
})

Scope your allowances

For hot wallets running unattended, prefer per-trade Permit2 signatures over infinite approvals to limit exposure if a key is compromised.

On-chain settlement#

A settlement is a single call to Router.execute with the encoded route, the minimum acceptable output, a recipient, and a deadline. The Router reverts if the realized output is below minAmountOut.

Router.sol
interface IRouterX {
    struct Route {
        address tokenIn;
        address tokenOut;
        uint256 amountIn;
        uint256 minAmountOut;
        address recipient;
        uint256 deadline;
        bytes   path;      // encoded adapter hops from the quote
    }

    /// @notice Executes a quoted route. Reverts on slippage or expiry.
    function execute(Route calldata route) external payable returns (uint256 amountOut);
}

The path field is copied verbatim from the quote response — you never construct it by hand.

Production checklist#

  • Verify contract addresses against on-chain bytecode before approving.
  • Always pass a tight deadline (seconds, not minutes) for MEV-sensitive flows.
  • Simulate the route in the same block you intend to land in.
  • Set minAmountOut from your own model, not only from the quote.
  • Monitor the Adapter Registry for newly added or paused venues.

Ready to script it? Head to the SDK or read the raw API reference.