Let's say I want to swap stablecoins, let's say USDC with DAI, in a CFMM where the function is the usual xy=k. Let's say that the liquidity is now fixed to be 1000USDC and 1000DAI, equals as they should be, so k=10^6.
Now if I want to swap 100 USDC, in order to satisfy the equation xy=k I should swap 100 USDC with 90.9DAI so that: (1000+100)*(1000-90.9)=k=10^6, without considering fees.
Why should someone swap like 100$ for 90.90$? What am I missing?

3 Answers 3


You're not missing absolutely anything, its because you swapped 10% of the exchange; one of the fallacies of using CPT curve

As an FYI; including the 0.3% fee, the correct answer is 100 USDC gets swapped for 90.661 DAI; see response using UniswapPy package below

enter image description here

or see Jupyter Notebook


You exchange 10% of the locked liquidity in a single trade. This would always result in a large amount of slippage.

For trading Dai/USDC you could get a better trade with an CFMM optimized for stablecoin-stablecoin swaps (e.g. Curve`s stableswap ).

The invariant used by Curve is a middle ground between the constant product formula (x * y = k) and the constant sum formula (x + y = k) and allows trades with significantly less slippage.


You are not missing anything.

What you are describing is a slippage that occurs when a large portion(e.g. 10%) of the pool is being exchanged. This is an unfortunate event for the user whether the user had anticipated or not.

Most of DEX interfaces out there will display users their computed slippage amount. So the situation that you describe is more of an user error if any.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.