Versions in this module Expand all Collapse all v1 v1.0.0 Mar 14, 2024 Changes in this version + const MaxTick + const MinTick + var ErrInvalidInput = errors.New("invalid input") + var ErrInvalidSqrtRatio = errors.New("invalid sqrt ratio") + var ErrInvalidTick = errors.New("invalid tick") + var ErrInvariant = errors.New("invariant violation") + var ErrLiquidityLessThanZero = errors.New("liquidity less than zero") + var ErrSqrtPriceLessThanZero = errors.New("sqrt price less than zero") + var MaxFee = new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) + var MaxSqrtRatio = new(big.Int).SetString("1461446703485210103287273052203988822378723970342", 10) + var MaxUint160 = new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(160), nil), constants.One) + var MinSqrtRatio = big.NewInt(4295128739) + var Q32 = big.NewInt(1 << 32) + func AddDelta(x, y *big.Int) *big.Int + func ComputePoolAddress(factoryAddress common.Address, tokenA *entities.Token, tokenB *entities.Token, ...) (common.Address, error) + func ComputeSwapStep(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, amountRemaining *big.Int, ...) (sqrtRatioNextX96, amountIn, amountOut, feeAmount *big.Int, err error) + func EncodeSqrtRatioX96(amount1 *big.Int, amount0 *big.Int) *big.Int + func GetAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, liquidity *big.Int, roundUp bool) *big.Int + func GetAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, liquidity *big.Int, roundUp bool) *big.Int + func GetNextSqrtPriceFromInput(sqrtPX96, liquidity, amountIn *big.Int, zeroForOne bool) (*big.Int, error) + func GetNextSqrtPriceFromOutput(sqrtPX96, liquidity, amountOut *big.Int, zeroForOne bool) (*big.Int, error) + func GetSqrtRatioAtTick(tick int) (*big.Int, error) + func GetTickAtSqrtRatio(sqrtRatioX96 *big.Int) (int, error) + func MaxLiquidityForAmounts(sqrtRatioCurrentX96 *big.Int, sqrtRatioAX96, sqrtRatioBX96 *big.Int, ...) *big.Int + func MostSignificantBit(x *big.Int) (int64, error) + func MulDivRoundingUp(a, b, denominator *big.Int) *big.Int + func PriceToClosestTick(price *entities.Price, baseToken, quoteToken *entities.Token) (int, error) + func TickToPrice(baseToken *entities.Token, quoteToken *entities.Token, tick int) (*entities.Price, error) + func ToHex(i *big.Int) string + type MethodParameters struct + Calldata []byte + Value *big.Int