Search Apps Documentation Source Content File Folder Download Copy Actions Download

v1 package

Overview

package v1 implements GnoSwap's concentrated liquidity pools based on Uniswap V3. It manages liquidity positions, executes swaps, and maintains pool state including price, liquidity, and fee calculations. The pool contract is the core of the GnoSwap AMM, supporting: - Concentrated liquidity within custom price ranges - Multiple fee tiers (0.01%, 0.05%, 0.3%, 1%) - Single-tick and cross-tick swaps - Protocol fee collection - Tick bitmap optimization for gas efficiency

Functions

GetPoolPath

func GetPoolPath(token0Path, token1Path string, fee uint32) string

GetPoolPath generates a unique pool path string based on the token paths and fee tier.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetPoolPath(,,)"

Result

GetPositionByPool

func GetPositionByPool(p *pl.Pool, key string) (pl.PositionInfo, bool)

GetPosition returns the position info for a given key.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetPositionByPool(,)"

Result

GetTickCumulativeOutside

func GetTickCumulativeOutside(p *pl.Pool, tick int32) int64

GetTickCumulativeOutside returns the cumulative liquidity outside the tick.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickCumulativeOutside(,)"

Result

GetTickFeeGrowthOutside0X128

func GetTickFeeGrowthOutside0X128(p *pl.Pool, tick int32) *u256.Uint

GetTickFeeGrowthOutside0X128 returns the fee growth outside the tick for token 0.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickFeeGrowthOutside0X128(,)"

Result

GetTickFeeGrowthOutside1X128

func GetTickFeeGrowthOutside1X128(p *pl.Pool, tick int32) *u256.Uint

GetTickFeeGrowthOutside1X128 returns the fee growth outside the tick for token 1.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickFeeGrowthOutside1X128(,)"

Result

GetTickInitialized

func GetTickInitialized(p *pl.Pool, tick int32) bool

GetTickInitialized returns whether the tick is initialized.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickInitialized(,)"

Result

GetTickLiquidityGross

func GetTickLiquidityGross(p *pl.Pool, tick int32) *u256.Uint

GetTickLiquidityGross returns the gross liquidity for the specified tick.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickLiquidityGross(,)"

Result

GetTickLiquidityNet

func GetTickLiquidityNet(p *pl.Pool, tick int32) *i256.Int

GetTickLiquidityNet returns the net liquidity for the specified tick.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickLiquidityNet(,)"

Result

GetTickSecondsOutside

func GetTickSecondsOutside(p *pl.Pool, tick int32) uint32

GetTickSecondsOutside returns the seconds outside the tick.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickSecondsOutside(,)"

Result

GetTickSecondsPerLiquidityOutsideX128

func GetTickSecondsPerLiquidityOutsideX128(p *pl.Pool, tick int32) *u256.Uint

GetTickSecondsPerLiquidityOutsideX128 returns the seconds per liquidity outside the tick.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.GetTickSecondsPerLiquidityOutsideX128(,)"

Result

NewPoolV1

func NewPoolV1(store pool.IPoolStore) pool.IPool

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.NewPoolV1()"

Result

PositionFeeGrowthInside0LastX128

func PositionFeeGrowthInside0LastX128(p *pl.Pool, key string) *u256.Uint

PositionFeeGrowthInside0LastX128 returns the fee growth of token0 inside a position.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.PositionFeeGrowthInside0LastX128(,)"

Result

PositionFeeGrowthInside1LastX128

func PositionFeeGrowthInside1LastX128(p *pl.Pool, key string) *u256.Uint

PositionFeeGrowthInside1LastX128 returns the fee growth of token1 inside a position.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.PositionFeeGrowthInside1LastX128(,)"

Result

PositionLiquidity

func PositionLiquidity(p *pl.Pool, key string) *u256.Uint

PositionLiquidity returns the liquidity of a position.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.PositionLiquidity(,)"

Result

PositionTokensOwed0

func PositionTokensOwed0(p *pl.Pool, key string) *u256.Uint

PositionTokensOwed0 returns the amount of token0 owed by a position.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.PositionTokensOwed0(,)"

Result

PositionTokensOwed1

func PositionTokensOwed1(p *pl.Pool, key string) *u256.Uint

PositionTokensOwed1 returns the amount of token1 owed by a position.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.PositionTokensOwed1(,)"

Result

NewTickEventInfo

func NewTickEventInfo(tickID int32, tickInfo pl.TickInfo) *tickEventInfo

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/pool/v1.NewTickEventInfo(,)"

Result