Hello everyone, welcome to Paul’s Crypto Quirks. If you are currently browsing Alpha and want to avoid large losses, quickly learn the underlying reasons with us. Follow Paul’s Crypto Quirks to understand the reasons for losses.

1. Cause

The above are two images Paul saw in the group. The first image indicates that a slippage of 0.1 was set, but still got stuck with 600 USDT, and the second image shows some specific manifestations. Today, let's discuss this in detail.

2. What is slippage?

Let's ask ourselves if we know what slippage is? Slippage means how much deviation of the trading price from the market price you can tolerate. For example, if you set a slippage of 0.1%, it means that if the transaction price exceeds the market price by 0.1%, the trade will be rejected. However, slippage ≠ preventing losses.


First, let's ask a question: What method is used for transactions in wallets? What method is used for transactions in centralized exchanges?

Earlier, we mentioned that centralized exchanges use a matching method to execute orders. If you are not familiar, you can check out Paul’s previous articles. However, wallets rely on DEX decentralized exchanges, which depend on AMM to execute. In terms of the underlying mechanism, if you are browsing Alpha, the wallet page will remind you that a slippage of 0.1% may fail to execute, but why is it 'may'? Because DEX relies on the blockchain, which changes every second, so it can only be described as 'may'.

3. AMM Mechanism

Since we are talking about this, let's detail the AMM mechanism.

AMM is the core mechanism of DEX (Decentralized Exchange). This mechanism does not require intermediaries and allows for automated trade matching. In simple terms, the AMM mechanism hands over the work of market makers from CEX (Centralized Exchange) to code, enabling users to complete their transactions on the blockchain.

Let's introduce using the Uniswap V2 version:

The core of AMM is the liquidity pool. In the V2 version, it follows a formula of x * y = k. Taking the ETH/USDC trading pair as an example:

Formula: x * y = k.

x: The number of ETH in the pool.

y: The number of USDC in the pool.

k: The total liquidity in the pool (a constant that remains unchanged)

Now if you buy ETH, it will cause the quantity of ETH in the pool to decrease, and the price will rise. Similarly, if you sell ETH, the quantity will increase, and the price will fall.

So can we conclude that when we trade on-chain, each transaction will change the price in the pool? Therefore, are we effectively trading against the liquidity in the pool?

4. Examples to help you understand.


Still the previous trading pair: ETH/USDC.

Now we have a pool dedicated to trading ETH/USDC. Currently, there is only you trading in this pool to avoid uncertainties caused by others.

The initial state of the pool: 100 ETH, 100000 USDC. According to the formula above, we can calculate that the initial price of ETH is 100000 / 100 = 1000 USDC.

Now you are a big player wanting to buy 10 ETH. How is this actually achieved?

According to the formula, calculate K, x * y = k, so k is 100 * 100000 = 10000000. Therefore, whether we buy or sell, we need to maintain this k at 10000000.

So now we need to buy 10 ETH, does that mean we just put in USDC? Can we write the formula like this?

(x−Δx)×(y+Δy)=10000000.

When we buy 10 ETH, there will only be 90 ETH left in the pool. According to the formula, can we calculate that the USDC in the pool is 10,000,000 / 90 ≈ 111111.11? Then Δy, which is the increase in the amount of USDC, would be 11111.11 USDC.

Now you have paid 11111.11 USDC to obtain 10 ETH, can we calculate the average price?

11111.11 / 10 = 1111.11 USDC/ETH.

Is there a price difference from what we initially saw? Why is that?

Because you pushed your price up and bought at a higher price.

Now let's calculate the price for each ETH we buy step by step:

This is actually an important characteristic of AMM: non-linear pricing curve.


5. Non-linear pricing curve

Still using the formula: x * y = k.

When we make a transaction, for example when you want to buy ETH, do we need to put USDC into this pool? The price is determined by the quantity in the pool, and does the price change in AMM take the form of a curve? The more you buy, the more it rises, and this curve becomes steeper.

6. How to reduce slippage.

  1. Small orders in batches: Do not place large orders all at once, especially when the pool is small. You can split them into multiple transactions or execute them over different time periods to reduce the impact on the pool.

  2. Choose pools with high liquidity: A larger pool = stronger resistance to impact.

  3. Accept reasonable slippage: Appropriately increase slippage (for example, 0.5%-1%) to prevent transaction failures due to slippage being too low.

  4. Avoid high volatility periods.: Avoid making large transactions when popular projects just launch or during periods of severe market fluctuations.