Swap Tutorial

Introduction

The swapping process on a DEX involves selling a user's existing tokens for a proportional amount of the desired tokens. During this process, a small swap fee is deducted and distributed as incentives to liquidity providers.

Price Impact

In a traditional order-book market, large buy orders can deplete available liquidity and result in higher execution prices. Swapping on a DEX differs from order book markets, as it executes against a passive liquidity pool rather than following a first-in-first-out policy.

In an protocol like Kriya supporting both AMM and CLMM, the relative value of assets continuously changes during a swap, causing the final execution price to fall between the starting and ending price. This dynamic is inherent to liquidity pool design and impacts every swap. Price impact depends on liquidity at different price points; higher liquidity leads to lower price impact, while lower liquidity results in higher price impact.

Kriya's interface provides real-time price impact estimates, including warnings for unusually high impacts, allowing users to assess the circumstances before executing a swap.

Slippage

Slippage is the potential price change during transaction processing on platforms like Kriya. To protect users, Kriya allows setting a slippage tolerance, limiting acceptable price impact. If the final execution price stays within this range, the transaction executes; otherwise, it fails.

Last updated