Jeiwan / uniswapv3-book

Uniswap V3 Development Book

Home Page:https://uniswapv3book.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An error in calculation

laurivil opened this issue · comments

Hi, there seems to be an error in milestone1 first-swap.md. The calculation after this line is erroneous:
"Luckily, we already know all the values, so we can plug them in right away (this might not fit on your screen!):"

image

image

5602277097478614198912276234240 and 5604469350942327889444743441197 are Q64.96 numbers, i.e. their base is $2^{96}$. The result shown in the book is a decimal number. To get the same result, you need to divide both number by $2^{96}$ before the calculation, or you can multiply the value you got by $2^{96}$.

I made this small fix to try to mitigate the confusion: e1a115d