Overview
Last modified:
Learn how CenturionDEX Universal Router composes v2 and v3 swaps with Permit2-based approvals in one transaction.
The UniversalRouter is a CTN and CRC20 swap router that aggregates trades across CenturionDEX v2 and v3. It is unowned and non-upgradeable.
Its command-based architecture supports:
- Splitting and interleaving of CenturionDEX v2/v3 swaps
- Partial fills of trades
- Wrapping and unwrapping of CTN (via WCTN)
- Time-bound, signature-controlled token approvals using Permit2
- v3 position manager interactions (for example, permit and liquidity modification)
- Sub-plan execution and balance checks
Transactions are encoded as a sequence of byte-sized commands, each with structured inputs. These commands can be chained in one transaction to express custom workflows, including multi-hop swaps and advanced routing plans.
How It Works
You call execute(...) with a commands byte string and a parallel inputs array. The router processes each command in order and routes execution to the corresponding module. This lets you combine swap, payment, approval, and position-manager actions without splitting logic across multiple transactions.
Permit2 Integration
UniversalRouter integrates with Permit2, so token transfer permissions can be provided by signature. This reduces repeated approval flows and enables more composable routing plans.
See Permit2 documentation for allowance and signature-transfer patterns.
Where to Go Next
- Review command encoding in Universal Router Commands
- Review token approval patterns in Permit2
- Review UniversalRouter GitHub Repository