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
GetPoolPath
func GetPoolPath(token0Path, token1Path string, fee uint32) string
Link
Execute
GetPoolPath generates a unique pool path string based on the token paths and fee tier.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetPoolPath( , , )"
GetPositionByPool
func GetPositionByPool(p *pl.Pool, key string) (pl.PositionInfo, bool)
Link
Execute
GetPosition returns the position info for a given key.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetPositionByPool( , )"
GetTickCumulativeOutside
func GetTickCumulativeOutside(p *pl.Pool, tick int32) int64
Link
Execute
GetTickCumulativeOutside returns the cumulative liquidity outside the tick.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickCumulativeOutside( , )"
GetTickFeeGrowthOutside0X128
func GetTickFeeGrowthOutside0X128(p *pl.Pool, tick int32) *u256.Uint
Link
Execute
GetTickFeeGrowthOutside0X128 returns the fee growth outside the tick for token 0.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickFeeGrowthOutside0X128( , )"
GetTickFeeGrowthOutside1X128
func GetTickFeeGrowthOutside1X128(p *pl.Pool, tick int32) *u256.Uint
Link
Execute
GetTickFeeGrowthOutside1X128 returns the fee growth outside the tick for token 1.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickFeeGrowthOutside1X128( , )"
GetTickInitialized
func GetTickInitialized(p *pl.Pool, tick int32) bool
Link
Execute
GetTickInitialized returns whether the tick is initialized.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickInitialized( , )"
GetTickLiquidityGross
func GetTickLiquidityGross(p *pl.Pool, tick int32) *u256.Uint
Link
Execute
GetTickLiquidityGross returns the gross liquidity for the specified tick.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickLiquidityGross( , )"
GetTickLiquidityNet
func GetTickLiquidityNet(p *pl.Pool, tick int32) *i256.Int
Link
Execute
GetTickLiquidityNet returns the net liquidity for the specified tick.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickLiquidityNet( , )"
GetTickSecondsOutside
func GetTickSecondsOutside(p *pl.Pool, tick int32) uint32
Link
Execute
GetTickSecondsOutside returns the seconds outside the tick.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickSecondsOutside( , )"
GetTickSecondsPerLiquidityOutsideX128
func GetTickSecondsPerLiquidityOutsideX128(p *pl.Pool, tick int32) *u256.Uint
Link
Execute
GetTickSecondsPerLiquidityOutsideX128 returns the seconds per liquidity outside the tick.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.GetTickSecondsPerLiquidityOutsideX128( , )"
NewPoolV1
func NewPoolV1(store pool.IPoolStore) pool.IPool
Link
Execute
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.NewPoolV1( )"
PositionFeeGrowthInside0LastX128
func PositionFeeGrowthInside0LastX128(p *pl.Pool, key string) *u256.Uint
Link
Execute
PositionFeeGrowthInside0LastX128 returns the fee growth of token0 inside a position.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.PositionFeeGrowthInside0LastX128( , )"
PositionFeeGrowthInside1LastX128
func PositionFeeGrowthInside1LastX128(p *pl.Pool, key string) *u256.Uint
Link
Execute
PositionFeeGrowthInside1LastX128 returns the fee growth of token1 inside a position.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.PositionFeeGrowthInside1LastX128( , )"
PositionLiquidity
func PositionLiquidity(p *pl.Pool, key string) *u256.Uint
Link
Execute
PositionLiquidity returns the liquidity of a position.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.PositionLiquidity( , )"
PositionTokensOwed0
func PositionTokensOwed0(p *pl.Pool, key string) *u256.Uint
Link
Execute
PositionTokensOwed0 returns the amount of token0 owed by a position.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.PositionTokensOwed0( , )"
PositionTokensOwed1
func PositionTokensOwed1(p *pl.Pool, key string) *u256.Uint
Link
Execute
PositionTokensOwed1 returns the amount of token1 owed by a position.
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.PositionTokensOwed1( , )"
NewTickEventInfo
func NewTickEventInfo(tickID int32, tickInfo pl.TickInfo) *tickEventInfo
Link
Execute
Command
gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land " -data "gno.land/r/gnoswap/pool/v1.NewTickEventInfo( , )"