def tick_to_price(tick: int) -> float:
    return 1.0001 ** tick

def uint32_tick_to_price(bits: int) -> float:
    # https://stackoverflow.com/a/20766900
    u = bits & ((1 << 32) - 1)
    tick = (u & ((1 << 31) - 1)) - (u & (1 << 31))
    return 1.0001 ** tick

q96 = 2**96
def price_to_sqrtp(p):
    return int(math.sqrt(p) * q96)