Is the direction flipped in the code? #46
Replies: 1 comment
-
This comes from how we usually count bits in binary numbers: from right to left. So, in a word, the highest price is at the highest (the leftmost) bit and the lowest price is at the lowest (the rightmost) bit. Words are traversed from left to right when price grows and from right to left when price falls, but bits inside a word are always ordered from right to left. This is how Uniswap does it, so I decided to leave it as it is, even though it might look confusing: |
Beta Was this translation helpful? Give feedback.
-
In Tick Bitmap index chapter it is mentioned that
"lte is the flag that sets the direction. When true, we’re selling token x and searching for next initialized tick to the right of the current one"
When I run the testcase testBuyUSDCConsecutivePriceRanges. I am selling ETH i.e selling token X. And lte is true.
The above subtracts. So we look for lower prices than current. So we look left and not right of the current tick?
Please help me understand why you mention we look to the right of the current one for the next initialized tick?
Beta Was this translation helpful? Give feedback.
All reactions