Overview
dKit’s routing engine intelligently finds the most efficient path for your swaps, whether direct or through multiple hops. The system considers factors like liquidity, fees, slippage, and execution time to optimize your trades.Route Types
Direct Routes
Single-hop swaps within one provider: Characteristics:- Single transaction
- Lower complexity
- Predictable fees
- Faster execution
Multi-Leg Routes
Swaps requiring multiple steps within a provider: Characteristics:- Multiple swaps in one transaction
- Optimized routing through liquidity pools
- Higher gas costs on EVM chains
- Better rates for illiquid pairs
DEX Aggregation Routes
Cross-provider routes combining different protocols: Characteristics:- Multiple transactions across chains
- Combines strengths of different providers
- Enables otherwise impossible swaps
- Requires careful tracking
Route Discovery Process
1. Asset Analysis
The routing engine first analyzes the assets:2. Provider Selection
Based on asset analysis, relevant providers are identified:3. Route Calculation
Each provider calculates possible routes:- Liquidity depth at each hop
- Price impact based on swap size
- Fee structure (network, protocol, LP fees)
- Execution time estimates
4. Route Optimization
Routes are ranked by:- Output amount (after all fees)
- Execution speed
- Route complexity
- Security considerations
Route Metadata
Each route includes rich metadata for decision-making:Price Impact
< 0.1%
- Negligible impact0.1% - 1%
- Low impact1% - 3%
- Moderate impact3% - 5%
- High impact> 5%
- Very high impact
Route Tags
Routes are tagged for easy identification:Tag | Description |
---|---|
FASTEST | Quickest execution time |
CHEAPEST | Lowest fees |
BEST | Best overall value |
RECOMMENDED | Platform recommendation |
Time Estimates
Complex Routing Examples
Cross-Chain Token to Token
Swapping USDC on Ethereum to USDC on Solana: Route Structure:Arbitrage Routes
Finding profitable paths between assets:Route Selection Strategies
Optimizing for Speed
Optimizing for Output
Balanced Optimization
Streaming Routes
For large swaps, THORChain automatically creates streaming routes:- Reduced price impact
- Better execution price
- Protection against manipulation
- Longer execution time
- Multiple transactions
- Complex tracking
Route Warnings
Routes may include warnings about potential issues:HIGH_PRICE_IMPACT
- Significant market impactLOW_LIQUIDITY
- Shallow poolsLONG_EXECUTION
- Extended completion timeREQUIRES_APPROVAL
- Token approval neededEXPERIMENTAL_ROUTE
- New or untested path
Route Execution
Pre-execution Checks
Transaction Building
Different routes require different transaction formats:Route Monitoring
Track multi-leg route progress:Best Practices
- Always check route validity before execution
- Monitor expiration times for time-sensitive routes
- Implement fallback routes for critical swaps
- Cache route calculations for repeated queries
- Use appropriate slippage based on route complexity
- Track all legs of multi-hop routes
- Handle partial fills gracefully