Module sqrt_price_math

Module sqrt_price_math 

Source

Functionsยง

encode_sqrt_ratio_x96
Encodes the sqrt ratio of two token amounts as a Q64.96 fixed point number.
expand_to_18_decimals
Expands an amount to 18 decimal places (multiplies by 10^18).
get_amount0_delta
Calculates the amount of token0 delta between two sqrt price ratios.
get_amount1_delta
Calculates the amount of token1 delta between two sqrt price ratios.
get_amounts_for_liquidity
Calculates the token amounts required for a given liquidity position.
get_next_sqrt_price_from_input
Calculates the next sqrt price given an input amount.
get_next_sqrt_price_from_output
Calculates the next sqrt price given an output amount.