import math
tick_upper_bits = 4294945516
tick_lower_bits = 4294931656
tick_curre_bits = 4294938547
sqrtp_low = price_to_sqrtp(uint32_tick_to_price(tick_lower_bits))
sqrtp_cur = price_to_sqrtp(uint32_tick_to_price(tick_curre_bits))
sqrtp_upp = price_to_sqrtp(uint32_tick_to_price(tick_upper_bits))
def calc_amount0(liq, pa, pb):
if pa > pb:
pa, pb = pb, pa
return int(liq * q96 * (pb - pa) / pa / pb)
def calc_amount1(liq, pa, pb):
if pa > pb:
pa, pb = pb, pa
return int(liq * (pb - pa) / q96)
liq = 8599967722
amount0 = calc_amount0(liq, sqrtp_upp, sqrtp_cur)
amount1 = calc_amount1(liq, sqrtp_low, sqrtp_cur)