EMPXRouter Contract
The EMPXRouter is the foundation of the system, providing gas-optimized token swapping with intelligent routing across multiple DEX protocols.
Core Concepts
Adapters
Adapters are trusted smart contracts that interface with individual DEX protocols. Each adapter implements standardized query and swap functions, allowing the router to interact with any DEX through a unified interface.
Routing Strategies
Strategy 1: Converge Swap (Split-Merge) This strategy splits the input amount across multiple paths to an intermediate token, then merges all intermediate tokens into the final output through a single adapter. Ideal for situations where multiple routes exist to a common intermediate token (e.g., stablecoins). Example: Swap WETH → USDC by splitting WETH across 3 DEXes to get USDT (intermediate), then swapping all USDT → USDC through the best route.

Strategy 2: Standard Split This strategy splits the input across multiple complete paths from input to output token, then aggregates the results. Each path can have multiple hops through different tokens. Example: Swap WETH → DAI by routing 60% through WETH→USDC→DAI and 40% through WETH→WBTC→DAI.
Security Features
- Reentrancy Protection: All swap functions are protected with OpenZeppelin’s
ReentrancyGuard. - Adapter Validation: Only whitelisted adapters can be used, preventing malicious contract interaction.
- Slippage Protection: Minimum output amount checks prevent sandwich attacks and price manipulation.
- Deadline Enforcement: Transaction expiry prevents stale orders from executing.
- Trusted Token List: Maintainer-controlled whitelist ensures only verified tokens are routed.