Multi-Hop Swaps Guide

Overview

Multi-hop swaps allow users to trade between tokens that don't have direct trading pairs by using intermediate tokens as bridges. JAMM DEX supports flexible multi-hop paths with different fee tiers for each hop, providing users with optimal swap routes.

Multi-Hop Swap Principles

Basic Concept

Multi-hop swaps break down a complex swap into multiple simple swaps:

TokenA → TokenB → TokenC

Each hop is an independent swap operation:

  1. First hop: TokenA → TokenB

  2. Second hop: TokenB → TokenC

Paths and Fees

In JAMM DEX, multi-hop swaps require specifying:

  • Path array: [TokenA, TokenB, TokenC]

  • Fees array: [fee1, fee2]

Note: The fees array length is always one less than the path array length.

Multi-Hop Swap Implementation

Exact Input Multi-Hop Swap

Exact Output Multi-Hop Swap

Path Optimization

Optimal Path Finding

Price Comparison

JU Token Multi-Hop Swaps

JU → Token → Token

Token → Token → JU

Advanced Multi-Hop Strategies

Split Swaps

Split large swaps into multiple smaller swaps to reduce price impact:

Dynamic Path Adjustment

Adjust swap paths based on real-time liquidity:

Monitoring and Analytics

Multi-Hop Swap Event Monitoring

Path Efficiency Analysis

Best Practices

1. Path Selection Strategy

2. Slippage Management

3. Gas Optimization

Summary

Multi-hop swaps are a powerful feature of JAMM DEX. This guide covers:

  1. Basic Principles: How multi-hop swaps work

  2. Implementation Methods: Exact input and output multi-hop swaps

  3. Path Optimization: Optimal path finding and price comparison

  4. Advanced Strategies: Split swaps and dynamic path adjustment

  5. Monitoring Analytics: Event monitoring and efficiency analysis

  6. Best Practices: Path selection, slippage management, gas optimization

By properly using multi-hop swaps, users can efficiently trade between a wider range of token pairs.