Swaps

Introduction

Swaps are a common way to start using DEXes. You simply pick an ERC-20 token from your wallet, choose another token you want, and swap them. The protocol charges a small fee for this service, which goes to the liquidity providers. Unlike traditional trading, L2X swaps use a pool of liquidity instead of matching individual orders, and fees are earned based on how much you contribute to the pool.

Price Impact

In traditional markets, large orders can affect prices significantly. L2X works differently. Using an automated market maker (AMM), L2X ensures prices adjust during a swap. The final price falls between the initial and final relative prices, typical of AMM systems. The amount of liquidity affects how much the price changes – more liquidity means less price change. The L2X interface shows the estimated price change before you make a swap.

Slippage

Slippage refers to the price change between starting a swap and finishing it. It's affected by how transactions are processed on Ethereum, based on the gas fee you pay. To help, L2X lets you set slippage limits. Your swap will only go through if the price stays within these limits.

Safety Checks

L2X prioritizes your safety with several checks:

  • Expired: This error appears if a swap takes longer than a set time threshold, ensuring swaps aren't affected by prolonged waiting durations.

  • INSUFFICIENT_OUTPUT_AMOUNT: L2X offers token amount projections during swaps. If the swap's output is way off (outside your slippage limits), the swap won't happen. This protects you from big price changes while your swap is pending.

Last updated