Simple Definition of Slippage
  • A trade that ends up being different from what's expected
  • It's due to change in the market by the time the trade is executed
  • Price is different by the time the transaction is settled because of latency between a user seeing a price on a DEX vs the actual transaction
What is Slippage?
  • Slippage occurs when the output of a trade ends up being different from what was expected due to a change in the market by the time the trade is executed.
  • Slippage: Let's say I want to sell 10 apples at $1 each. However, in between submitting the trade and it being executed there is a drop in the price of apples. Therefore, I end up getting $9.50 for selling 10 apples instead of $10.
  • Price Impact: Low liquidity in a market can also lead to price issues. Imagine I'm trying to spend $10 to buy 10 apples at $1. But only 5 apples are being sold at $1. I would have to buy the rest at $1.10. Therefore, I get 9.5 apples for $10 due to a lack of liquidity.

Since there aren't enough apples being sold at $1 some will be purchased at $1.10 due to the price impact of the trade

Slippage on a Decentralized Exchange
  • Similar to traditional exchanges, there are two main scenarios where expected output can be different while trading on a decentralized exchange.
  • Slippage: Transactions in Ethereum are generated by a user, submitted to be processed by a miner, and finally added on-chain. However, since there is some latency between a user seeing a price on a decentralized exchange and the actual transaction being processed, the price could be drastically different by the time the transaction is settled.
  • Price Impact:  If the size of a trade is too large relative to the amount of liquidity in the exchange it can harm the price. Many decentralized exchanges follow a constant product formula for determining the output of a swap. In the image below, we can see that given this constant product curve, the larger swaps will push the price out towards the edges of the curve. As a result, if you try to swap a large amount of token B in a single transaction the worse the conversion rate will be for token A if the volume of the swap is large relative to the total liquidity of that pair.

Price Impact for swapping token B for token A

Uniswap v3 tries to fix this issue with the idea of concentrated liquidity, which you can read more about here.