What it offers
- swap: Swap tokens via path-based routing with encoded swap data and step-based execution
Notes
- Swap data (
datafield in steps) must be ABI-encoded off-chain:abi.encode(tokenIn, recipient, withdrawMode) withdrawMode:0= keep in vault (for chaining),1= withdraw to user wallet,2= unwrap WETH to native ETH- Each path can have multiple steps (multi-hop), and you can include multiple paths in one transaction
- Steps support callbacks for flash-swap-like patterns (set to zero address for standard swaps)
- Pool addresses must be discovered off-chain (via SyncSwap’s factory or API)
- zkSync-only deployment
- Input token must be ERC20-approved to the Router
Its names in a program
On zkSync Era,Syncswap is a namespace: its contracts need no import.
Deployments
ABI
SyncSwapRouterABI
import SyncSwapRouterABI from "./protocols/syncswap/SyncSwapRouterABI.json"; Speaks for: router.
swap(((address pool, bytes data, address callback, bytes callbackData)[] steps, address tokenIn, uint256 amountIn)[] paths, uint256 amountOutMin, uint256 deadline) payable returns ((address token, uint256 amount) amountOut)
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
