Skip to main content

Universal Router

Overview

The UniversalRouter is a pool discovery and route validation contract. It provides helper functions for finding pools, validating multi-hop paths, and creating new pools through the factory.

Important

Due to FHE encrypted input verification, the router cannot execute swaps or liquidity operations on behalf of users. Encrypted inputs are bound to the pool address they were created for. Users must call pool functions directly.

Core Functions

createPool

function createPool(
IERC7984 tokenA,
IERC7984 tokenB,
uint24 fee,
string memory pairName,
string memory pairSymbol,
string memory pairTokenURI
) external returns (address pool)

Wrapper around EPoolFactory.createPool. Deploys a new EPOOL for the token pair.

getPool

function getPool(
IERC7984 tokenA,
IERC7984 tokenB,
uint24 fee
) external view returns (address pool)

Looks up a pool by token pair and fee tier. Returns address(0) if not found.

quotePath

function quotePath(
address[] calldata path,
uint24[] calldata fees
) external view returns (address[] memory pools)

Validates a multi-hop path and returns the pool address for each hop.

poolExists

function poolExists(
IERC7984 tokenA,
IERC7984 tokenB,
uint24 fee
) external view returns (bool)

isValidPath

function isValidPath(
address[] calldata path,
uint24[] calldata fees
) external view returns (bool)

Validates that every hop in the path has a deployed pool.

Helper Utilities (UniversalRouterHelper)

FunctionPurpose
validatePathCheck path array validity
getPoolsForPathResolve pools for each hop
sortTokensCanonical token ordering
getSwapDirectionDetermine if swap is A-to-B or B-to-A for a given pool

Multi-Hop Routing

For multi-hop swaps (e.g. eBTC -> eUSD -> eETH), the user must:

  1. Use quotePath to find pools for each hop
  2. Execute each hop separately, calling each pool directly
  3. The output of one swap becomes the input of the next

This is required because encrypted inputs are pool-bound.

Deployed Addresses

NetworkAddress
Ethereum Sepolia0x6ef96225151e207cA92cF923C4edD0aC3235842c
Arbitrum Sepolia0x4C57D92DFfBb16dC03B9c03A650C9abC9B581DC7