Skip to content
Permalink

Comparing changes

Choose two branches to see what鈥檚 changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: uniswap-python/uniswap-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: TimeToBuildBob/uniswap-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don鈥檛 worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Oct 6, 2026

  1. fix: correct integer-shift price floor and odd-tick TVL bounds

    v3/v4 raw price: move the 2**192 divisor outside the integer shift so
    fractional sqrtPriceX96 values are not truncated before the decimal
    scaling. (sqrtPriceX96**2 * 10**den1 >> 192) / 10**den0 floors too
    early for low-price tokens (e.g. 9.87e-6 returns 9e-6; 4.9e-7 returns
    zero and the reciprocal raises ZeroDivisionError). Change to
    (sqrtPriceX96**2 * 10**den1) / ((1 << 192) * 10**den0).
    
    get_tvl_in_pool: replace tick // 2 with tick / 2 for the sqrt-price
    boundary exponent. Integer floor-division produces wrong results for
    odd ticks (fee=100, tick_spacing=1): position [0,1) returns zero
    token0 instead of ~4.999625e13; [1,2) doubles; negative odd ticks
    also overcount. Floating-point tick / 2 recovers the correct bounds.
    
    Reported by Xamit Kadirbekov and Daniyal Kadirbekov (GERO numerical
    software assurance, https://www.gero.uz/research/). Relates to
    issue #269 (low-price floor, still open).
    
    Co-Authored-By: Bob <bob@superuserlabs.org>
    TimeToBuildBob committed Oct 6, 2026
    Configuration menu
    Copy the full SHA
    7ea6442 View commit details
    Browse the repository at this point in the history
Loading