Swap Router
Stateless router for executing token swaps against WarpX V3 pools with optimal routing.
Exact Input (Single Hop)
struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96;}function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut)Field
Description
// Swap exactly 1000 USDC for WETHISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({ tokenIn: USDC, tokenOut: WETH, fee: 3000, recipient: msg.sender, deadline: block.timestamp + 300, amountIn: 1000e6, amountOutMinimum: 0.4e18, // Min 0.4 WETH sqrtPriceLimitX96: 0});uint256 amountOut = swapRouter.exactInputSingle(params);Exact Input (Multi-Hop)
struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum;}function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut)Exact Output (Single Hop)
Exact Output (Multi-Hop)
Token Approvals
Handling Native ETH
Price Limits
Best Practices
Interface
Last updated