1/5
## Slippage Slippage is the difference between the price you expect to receive when trading on a decentralized exchange (DEX) and the price you actually receive. It is caused by the way DEXs, such as Uniswap, calculate the amount of tokens traded. Let's look at an example. Suppose we want to swap DAI for ETH. We check the current price on the DEX, which is 1 ETH = 2000 DAI. If we send 2000 DAI to the DEX, we expect to receive 1 ETH in return. However, let's say that another trader, Bob, simultaneously sends 2000 DAI to the DEX to buy ETH. Since Bob's trade is also executed, the price of ETH changes. The DEX recalculates the price of ETH, and it is now 0.99 ETH = 2000 DAI. In this situation, Bob gets 0.99 ETH, while we get 1 ETH. The difference is because of the slippage. The slippage will vary depending on a number of factors such as: - **The size of your trade:** Larger trades will result in more slippage. - **The liquidity of the trading pair:** Less liquid trading pairs will result in more slippage. - **Market volatility:** If the market is volatile, there will be more slippage. We can visualize slippage using an AMM curve. This curve represents the relationship between the amount of DAI and ETH in the liquidity pool. As we trade on the DEX, the curve shifts. The amount of ETH we receive is represented by the length of the blue line on the curve. The length of the blue line for Bob's trade is shorter than the length of the blue line for our trade. Because of the way the AMM curve is curved, the amount of ETH we receive diminishes with each trade.
An illustrative explanation of slippage in AMMs - This video covers what slippage is in the context of automated market makers (AMMs), explaining the concept using an example, and detailing how slippage is caused by market movement.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 9, 2024
Solidity Developer
Uniswap V2Duration: 14min
Duration: 1h 20min
Duration: 10min
Duration: 54min
Duration: 25min
Duration: 26min
Duration: 1h 03min
Duration: 59min
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 9, 2024
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar