Contracts
Swap router
Router Contract
The Router contract handles the execution of swaps and ensures tokens are transferred correctly between pools.
Key Features
- Multi-hop swaps
- Exact input/output swaps
- Slippage protection
- Support for native token wrapping/unwrapping
Core Functions
Architecture Overview
Security Considerations
- Slippage Protection
- Deadline Checks
Security Considerations
Our router implements two key security features that are controlled by the user during transaction construction:
1. Slippage Protection
Users can specify their maximum acceptable slippage when building a transaction. This prevents excessive value loss due to price movements or MEV attacks.
Example parameters controlled by user:
User Control
All security parameters are set during transaction construction and cannot be modified by the router contract. This gives users complete control over their risk tolerance:
-
Slippage Tolerance: Users can set aggressive or relaxed slippage limits based on:
- Market volatility
- Transaction size
- Urgency of execution
-
Transaction Deadline: Users can set appropriate timeouts based on:
- Network congestion
- Transaction priority
- Expected execution time
Best Practices
- Consider using our SDK’s built-in security parameter calculations