Closed nampc1 closed 2 months ago
https://calculator.academy/price-impact-calculator/ https://stackoverflow.com/questions/74282316/uniswap-v2-pool-priceimpact https://support.uniswap.org/hc/en-us/articles/8643794102669-Price-Impact-vs-Price-Slippage https://dailydefi.org/articles/price-impact-and-how-to-calculate/ https://stackoverflow.com/questions/74282316/uniswap-v2-pool-priceimpact https://medium.com/@arian.web3developer/everything-about-price-impact-slippage-rate-and-deadline-in-dex-swaps-explained-on-uniswap-dex-7f700ffa3948 https://blog.uniswap.org/uniswap-v3-math-primer https://blog.uniswap.org/uniswap-v3-math-primer-2 https://medium.com/luchadores-chronicles/how-to-calculate-price-impact-b4c87d8b10ed
Short note: We apply Fomular 3. Base formulation:
Where:
=> Finally formula 1: PI = ym/k
=> Finally formula 2: PI = m/x
=> Finally formula 3: PI = (x + m)^2 / xy
Version test: https://9dcf8574.subwallet-webapp.pages.dev/ Validation passed in case:
Re-check:
Version test: https://00ebb04b.subwallet-webapp.pages.dev/
Validation passed in cases:
We need to calculate price impact for swaps on Asset Hub to warn users