TokenRouter
TheTokenRouter is the swap execution and price oracle layer. On testnet, it operates as a mock DEX that executes trades at oracle-set prices. On mainnet, it will be replaced by an RFQ system with institutional liquidity providers.
Functions
Price Oracle
| Function | Description |
|---|---|
getTokenPrice(address token) | Returns USD price in 18-decimal precision |
tokenPrices(address token) | Direct storage mapping for token prices |
setTokenPricesBatch().
Swap Execution
| Function | Description |
|---|---|
swap(address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut) | Execute a trade at oracle prices |
getQuote(address tokenIn, address tokenOut, uint256 amountIn) | Preview the output amount |
Pair Management
| Function | Description |
|---|---|
setPairSupported(address tokenA, address tokenB, bool supported) | Enable/disable a trading pair |
Testnet Behavior
On testnet, theTokenRouter (actually MockTokenRouter):
- Mints output tokens to the caller (simulates swap execution)
- Burns input tokens from the caller
- Trades at exact oracle prices (no slippage simulation)
- Prices set by an authorized reporter wallet
Mainnet Plan
On mainnet, theTokenRouter will be replaced by:
- RFQ (Request for Quote) system with Robinhood L2 market makers
- Institutional-grade liquidity for all supported assets
- Real market impact and slippage
- Settlement against actual tokenized RWA markets