Multi-Hop Swap
Sequential swaps through intermediate tokens
Structure
TokenA ──[DEX 1]──> TokenB ──[DEX 2]──> TokenC
(Hop 1) (Hop 2)When Multi-Hop is Used
Common Routing Patterns
Pattern 1: Through Native Token
Pattern 2: Through Stablecoin
Pattern 3: Extended Hop (Rare)
Example Response
Real Example: CAKE → USDT
Smart Contract Encoding
MultiHopSwapParams Structure
Execution Flow
Gas Costs
Hops
BSC Gas
Ethereum Gas
vs Simple
Advantages
✅ Enables Unavailable Swaps
✅ Accesses Deep Liquidity
✅ Predictable Routing
Limitations
❌ Higher Gas Costs
❌ Compounding Slippage
❌ Increased Failure Risk
❌ Higher Price Impact
Code Examples
JavaScript Implementation
Python Implementation
Best Practices
✅ Higher Slippage Tolerance
✅ Verify Bridge Token Liquidity
✅ Monitor Bridge Token Prices
✅ Set Appropriate Deadline
Troubleshooting
Issue: "Insufficient output amount" Error
Issue: One Hop Fails, TX Reverts
Issue: Worse Rate Than Expected
Comparison with Other Types
Feature
Simple
Multi-Hop
Batch
Related Topics
Summary
Last updated