Same-chain trading
Same-chain swaps route through Torque's Enso integration to aggregate depth across connected DEX liquidity pools instead of forcing a single venue. Expect consolidated quotes, clearer price impact, & fewer manual hops than wiring routers yourself—still confirm slippage & deadlines in the UI before execution.
Overview
Multi-DEX Routing
Torque queries multiple DEXs to find optimal trade routes for same-chain trades.
Price Optimization
Routes are optimized for best price, considering gas costs, slippage, & price impact.
MEV Protection
Built-in protection against front-running & sandwich attacks.
Supported Chains
✓Ethereum
✓Base
✓Arbitrum
✓Polygon
✓Optimism
Integration
trade-integration.ts
import { getTradeRoute, executeTrade } from '@/lib/torque'
// Get optimal trade route
const route = await getTradeRoute({
fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
toToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
amount: '1000000000', // 1000 USDC
fromAddress: userAddress,
chainId: 1, // Ethereum
slippage: 50, // 0.5%
})
console.log('Route:', route.route)
console.log('Expected output:', route.amountOut)
console.log('Price impact:', route.priceImpact)
console.log('Gas estimate:', route.gasEstimate)
// Execute the trade
const receipt = await executeTrade({
route,
wallet: userWallet,
})
console.log('Transaction hash:', receipt.hash)Was this helpful?