Search Apps Documentation Source Content File Folder Download Copy Actions Download

pool package

Functions

Burn

func Burn( cur realm, token0Path string, token1Path string, fee uint32, tickLower int32, tickUpper int32, liquidityAmount string, positionCaller address, ) (string, string)

Burn removes liquidity from a position.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Burn" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Burn" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Collect

func Collect( cur realm, token0Path string, token1Path string, fee uint32, recipient address, tickLower int32, tickUpper int32, amount0Requested string, amount1Requested string, ) (string, string)

Collect transfers owed tokens from a position to recipient.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Collect" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Collect" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

CollectProtocol

func CollectProtocol( cur realm, token0Path string, token1Path string, fee uint32, recipient address, amount0Requested string, amount1Requested string, ) (string, string)

CollectProtocol collects protocol fees from a pool. Parameters: - token0Path: path of the first token - token1Path: path of the second token - fee: pool fee tier - recipient: recipient address for fees - amount0Requested: amount of token0 to collect - amount1Requested: amount of token1 to collect Returns: - string: amount of token0 collected - string: amount of token1 collected

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "CollectProtocol" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "CollectProtocol" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

CreatePool

func CreatePool( cur realm, token0Path string, token1Path string, fee uint32, sqrtPriceX96 string, )

CreatePool creates a new liquidity pool for a token pair. Parameters: - token0Path: path of the first token - token1Path: path of the second token - fee: pool fee tier - sqrtPriceX96: initial sqrt price (Q64.96 format)

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "CreatePool" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "CreatePool" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

DecodeTickKey

func DecodeTickKey(s string) int32

DecodeTickKey decodes a string key to a tick.

Param

Command

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

Result

DrySwap

func DrySwap( token0Path string, token1Path string, fee uint32, zeroForOne bool, amountSpecified string, sqrtPriceLimitX96 string, ) (string, string, bool)

DrySwap simulates a swap without executing it, returning the expected output. This is a read-only operation that does not modify pool state. Used by router for multi-hop swap simulations and by clients for price quotes. Parameters: - token0Path: path of the first token - token1Path: path of the second token - fee: pool fee tier - zeroForOne: true if swapping token0 for token1 - amountSpecified: amount to swap - sqrtPriceLimitX96: price limit for the swap Returns: - string: amount of token0 delta - string: amount of token1 delta - bool: swap success status

Params

Command

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

Result

EncodeTickKey

func EncodeTickKey(tick int32) string

EncodeTickKey encodes a tick to a string key for the tick tree.

Param

Command

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

Result

ExistsPoolPath

func ExistsPoolPath(poolPath string) bool

ExistsPoolPath checks if a pool exists at the given path.

Param

Command

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

Result

GetBalanceToken0

func GetBalanceToken0(poolPath string) string

GetBalanceToken0 returns the balance of token0 in the pool.

Param

Command

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

Result

GetBalanceToken1

func GetBalanceToken1(poolPath string) string

GetBalanceToken1 returns the balance of token1 in the pool.

Param

Command

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

Result

GetBalances

func GetBalances(poolPath string) (string, string)

GetBalances returns the balances of the pool.

Param

Command

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

Result

GetFee

func GetFee(poolPath string) uint32

GetFee returns the fee tier of the pool.

Param

Command

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

Result

GetFeeAmountTickSpacing

func GetFeeAmountTickSpacing(fee uint32) (spacing int32)

GetFeeAmountTickSpacing returns the tick spacing for a given fee tier.

Param

Command

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

Result

GetFeeAmountTickSpacings

func GetFeeAmountTickSpacings() map[uint32]int32

GetFeeAmountTickSpacings returns all fee tier to tick spacing mappings.

Command

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

Result

GetFeeGrowthGlobal0X128

func GetFeeGrowthGlobal0X128(poolPath string) string

GetFeeGrowthGlobal0X128 returns the global fee growth for token0.

Param

Command

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

Result

GetFeeGrowthGlobal1X128

func GetFeeGrowthGlobal1X128(poolPath string) string

GetFeeGrowthGlobal1X128 returns the global fee growth for token1.

Param

Command

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

Result

GetFeeGrowthGlobalX128

func GetFeeGrowthGlobalX128(poolPath string) (*u256.Uint, *u256.Uint)

GetFeeGrowthGlobalX128 returns the global fee growth for both tokens.

Param

Command

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

Result

GetFeeGrowthGlobals

func GetFeeGrowthGlobals(poolPath string) (string, string)

GetFeeGrowthGlobals returns the global fee growth for both tokens.

Param

Command

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

Result

GetImplementationPackagePath

func GetImplementationPackagePath() string

GetImplementationPackagePath returns the package path of the currently active implementation.

Command

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

Result

GetInitializedTicksInRange

func GetInitializedTicksInRange(poolPath string, tickLower, tickUpper int32) []int32

GetInitializedTicksInRange returns initialized ticks within the given range.

Params

Command

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

Result

GetLiquidity

func GetLiquidity(poolPath string) string

GetLiquidity returns the current liquidity in the pool.

Param

Command

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

Result

GetMaxLiquidityPerTick

func GetMaxLiquidityPerTick(poolPath string) string

GetMaxLiquidityPerTick returns the maximum liquidity per tick for the pool.

Param

Command

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

Result

GetObservation

func GetObservation(poolPath string, secondsAgo int64) (tickCumulative int64, liquidityCumulative, secondsPerLiquidityCumulativeX128 string, blockTimestamp int64)

GetObservation returns observation data for calculating time-weighted averages.

Params

Command

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

Result

GetPoolCount

func GetPoolCount() int

GetPoolCount returns the total number of pools.

Command

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

Result

GetPoolCreationFee

func GetPoolCreationFee() int64

GetPoolCreationFee returns the current pool creation fee.

Command

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

Result

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.GetPoolPath(,,)"

Result

GetPoolPaths

func GetPoolPaths(offset, count int) []string

GetPoolPaths returns a paginated list of pool paths.

Params

Command

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

Result

GetPoolPositionCount

func GetPoolPositionCount(poolPath string) int

GetPoolPositionCount returns the number of positions in a pool.

Param

Command

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

Result

GetPoolPositionKeys

func GetPoolPositionKeys(poolPath string, offset, count int) []string

GetPoolPositionKeys returns a paginated list of position keys in a pool.

Params

Command

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

Result

GetPositionFeeGrowthInside0LastX128

func GetPositionFeeGrowthInside0LastX128(poolPath, key string) string

GetPositionFeeGrowthInside0LastX128 returns the last recorded fee growth inside for token0.

Params

Command

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

Result

GetPositionFeeGrowthInside1LastX128

func GetPositionFeeGrowthInside1LastX128(poolPath, key string) string

GetPositionFeeGrowthInside1LastX128 returns the last recorded fee growth inside for token1.

Params

Command

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

Result

GetPositionFeeGrowthInsideLastX128

func GetPositionFeeGrowthInsideLastX128(poolPath, key string) (*u256.Uint, *u256.Uint)

GetPositionFeeGrowthInsideLastX128 returns the last recorded fee growth inside for both tokens.

Params

Command

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

Result

GetPositionFeeGrowthInsideLasts

func GetPositionFeeGrowthInsideLasts(poolPath, key string) (string, string)

GetPositionFeeGrowthInsideLasts returns the last recorded fee growth inside for both tokens.

Params

Command

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

Result

GetPositionLiquidity

func GetPositionLiquidity(poolPath, key string) *u256.Uint

GetPositionLiquidity 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.GetPositionLiquidity(,)"

Result

GetPositionTokensOwed

func GetPositionTokensOwed(poolPath, key string) (string, string)

GetPositionTokensOwedInfos returns the amount of tokens owed for both tokens.

Params

Command

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

Result

GetPositionTokensOwed0

func GetPositionTokensOwed0(poolPath, key string) string

GetPositionTokensOwed0 returns the amount of token0 owed to a position.

Params

Command

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

Result

GetPositionTokensOwed1

func GetPositionTokensOwed1(poolPath, key string) string

GetPositionTokensOwed1 returns the amount of token1 owed to a position.

Params

Command

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

Result

GetProtocolFeesToken0

func GetProtocolFeesToken0(poolPath string) string

GetProtocolFeesToken0 returns accumulated protocol fees for token0.

Param

Command

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

Result

GetProtocolFeesToken1

func GetProtocolFeesToken1(poolPath string) string

GetProtocolFeesToken1 returns accumulated protocol fees for token1.

Param

Command

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

Result

GetProtocolFeesTokens

func GetProtocolFeesTokens(poolPath string) (string, string)

GetProtocolFeesTokens returns the accumulated protocol fees for both tokens.

Param

Command

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

Result

GetSlot0FeeProtocol

func GetSlot0FeeProtocol(poolPath string) uint8

GetSlot0FeeProtocol returns the protocol fee rate from slot0.

Param

Command

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

Result

GetSlot0SqrtPriceX96

func GetSlot0SqrtPriceX96(poolPath string) *u256.Uint

GetSlot0SqrtPriceX96 returns the current sqrt price from slot0.

Param

Command

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

Result

GetSlot0Tick

func GetSlot0Tick(poolPath string) int32

GetSlot0Tick returns the current tick from slot0.

Param

Command

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

Result

GetSlot0Unlocked

func GetSlot0Unlocked(poolPath string) bool

GetSlot0Unlocked returns the locked status from slot0.

Param

Command

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

Result

GetTWAP

func GetTWAP(poolPath string, secondsAgo uint32) (int32, *u256.Uint, error)

GetTWAP returns the time-weighted average price for a pool. Returns arithmetic mean tick and harmonic mean liquidity over the time period.

Params

Command

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

Result

GetTickBitmaps

func GetTickBitmaps(poolPath string, wordPos int16) (*u256.Uint, error)

GetTickBitmaps returns the tick bitmap for a given word position.

Params

Command

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

Result

GetTickCumulativeOutside

func GetTickCumulativeOutside(poolPath string, tick int32) int64

GetTickCumulativeOutside returns the tick cumulative value outside a tick.

Params

Command

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

Result

GetTickFeeGrowthOutside0X128

func GetTickFeeGrowthOutside0X128(poolPath string, tick int32) string

GetTickFeeGrowthOutside0X128 returns fee growth outside for token0 at a tick.

Params

Command

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

Result

GetTickFeeGrowthOutside1X128

func GetTickFeeGrowthOutside1X128(poolPath string, tick int32) string

GetTickFeeGrowthOutside1X128 returns fee growth outside for token1 at a tick.

Params

Command

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

Result

GetTickFeeGrowthOutsideX128

func GetTickFeeGrowthOutsideX128(poolPath string, tick int32) (*u256.Uint, *u256.Uint)

GetTickFeeGrowthOutsideX128 returns fee growth outside for both tokens at a tick.

Params

Command

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

Result

GetTickFeeGrowthOutsides

func GetTickFeeGrowthOutsides(poolPath string, tick int32) (string, string)

GetTickFeeGrowthOutsides returns fee growth outside for both tokens at a tick.

Params

Command

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

Result

GetTickInitialized

func GetTickInitialized(poolPath string, tick int32) bool

GetTickInitialized returns whether a tick is initialized.

Params

Command

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

Result

GetTickLiquidityGross

func GetTickLiquidityGross(poolPath string, tick int32) string

GetTickLiquidityGross returns the total liquidity that references a tick.

Params

Command

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

Result

GetTickLiquidityNet

func GetTickLiquidityNet(poolPath string, tick int32) string

GetTickLiquidityNet returns the net liquidity change at a tick.

Params

Command

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

Result

GetTickSecondsOutside

func GetTickSecondsOutside(poolPath string, tick int32) uint32

GetTickSecondsOutside returns seconds spent outside a tick.

Params

Command

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

Result

GetTickSecondsPerLiquidityOutsideX128

func GetTickSecondsPerLiquidityOutsideX128(poolPath string, tick int32) string

GetTickSecondsPerLiquidityOutsideX128 returns seconds per liquidity outside a tick.

Params

Command

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

Result

GetTickSpacing

func GetTickSpacing(poolPath string) int32

GetTickSpacing returns the tick spacing of the pool.

Param

Command

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

Result

GetToken0Path

func GetToken0Path(poolPath string) string

GetToken0Path returns the path of token0 in the pool.

Param

Command

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

Result

GetToken1Path

func GetToken1Path(poolPath string) string

GetToken1Path returns the path of token1 in the pool.

Param

Command

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

Result

GetWithdrawalFee

func GetWithdrawalFee() uint64

GetWithdrawalFee returns the current withdrawal fee rate.

Command

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

Result

HandleWithdrawalFee

func HandleWithdrawalFee( cur realm, positionId uint64, token0Path string, amount0 string, token1Path string, amount1 string, poolPath string, positionCaller address, ) (string, string)

HandleWithdrawalFee processes withdrawal fees for a position. Parameters: - positionId: ID of the position - token0Path: path of the first token - amount0: amount of token0 to withdraw - token1Path: path of the second token - amount1: amount of token1 to withdraw - poolPath: pool identifier - positionCaller: caller address for the position Returns: - string: net amount of token0 after fees - string: net amount of token1 after fees

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "HandleWithdrawalFee" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "HandleWithdrawalFee" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

IncreaseObservationCardinalityNext

func IncreaseObservationCardinalityNext( cur realm, token0Path string, token1Path string, fee uint32, cardinalityNext uint16, )

IncreaseObservationCardinalityNext increases the observation cardinality for a pool. Parameters: - token0Path: path of the first token - token1Path: path of the second token - fee: pool fee tier - cardinalityNext: new observation cardinality limit

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "IncreaseObservationCardinalityNext" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "IncreaseObservationCardinalityNext" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Mint

func Mint( cur realm, token0Path string, token1Path string, fee uint32, tickLower int32, tickUpper int32, liquidityAmount string, positionCaller address, ) (string, string)

Mint adds liquidity to a position. Parameters: - token0Path: path of the first token - token1Path: path of the second token - fee: pool fee tier - tickLower: lower tick boundary - tickUpper: upper tick boundary - liquidityAmount: amount of liquidity to add - positionCaller: caller address for the position Returns: - string: amount of token0 added - string: amount of token1 added

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Mint" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Mint" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

ParsePoolPath

func ParsePoolPath(poolPath string) (string, string, uint32)

Param

Command

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

Result

RegisterInitializer

func RegisterInitializer(cur realm, initializer func(poolStore IPoolStore) IPool)

RegisterInitializer registers a new pool implementation version. This function is called by each version (v1, v2, etc.) during initialization to register their implementation with the proxy system. The initializer function creates a new instance of the implementation using the provided poolStore interface. The stateInitializer function creates the initial state for this version. Security: Only contracts within the domain path can register initializers. Each package path can only register once to prevent duplicate registrations.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "RegisterInitializer" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "RegisterInitializer" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetFeeProtocol

func SetFeeProtocol(cur realm, feeProtocol0, feeProtocol1 uint8)

SetFeeProtocol sets the protocol fee rates for a pool. Parameters: - feeProtocol0: protocol fee rate for token0 - feeProtocol1: protocol fee rate for token1

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetFeeProtocol" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetFeeProtocol" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetPoolCreationFee

func SetPoolCreationFee(cur realm, fee int64)

SetPoolCreationFee sets the pool creation fee.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetPoolCreationFee" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetPoolCreationFee" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetSwapEndHook

func SetSwapEndHook(cur realm, hook func(cur realm, poolPath string) error)

SetSwapEndHook sets the hook to be called at the end of a swap.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetSwapEndHook" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetSwapEndHook" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetSwapStartHook

func SetSwapStartHook(cur realm, hook func(cur realm, poolPath string, timestamp int64))

SetSwapStartHook sets the hook to be called at the start of a swap.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetSwapStartHook" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetSwapStartHook" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetTickCrossHook

func SetTickCrossHook(cur realm, hook func(cur realm, poolPath string, tickId int32, zeroForOne bool, timestamp int64))

SetTickCrossHook sets the hook to be called when a tick is crossed during a swap.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetTickCrossHook" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetTickCrossHook" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetWithdrawalFee

func SetWithdrawalFee(cur realm, fee uint64)

SetWithdrawalFee sets the withdrawal fee rate. Parameters: - fee: withdrawal fee in basis points

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetWithdrawalFee" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "SetWithdrawalFee" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Swap

func Swap( cur realm, token0Path string, token1Path string, fee uint32, recipient address, zeroForOne bool, amountSpecified string, sqrtPriceLimitX96 string, payer address, swapCallback func(cur realm, amount0Delta, amount1Delta int64, callbackMarker *CallbackMarker) error, ) (string, string)

Swap executes a token swap in the pool. Parameters: - token0Path: path of the first token - token1Path: path of the second token - fee: pool fee tier - recipient: recipient address for output tokens - zeroForOne: true if swapping token0 for token1 - amountSpecified: amount to swap (positive for exact input, negative for exact output) - sqrtPriceLimitX96: price limit for the swap - payer: address that will pay for the swap - swapCallback: callback function for token transfer, callbackMarker is used to identify the callback Returns: - string: amount of token0 delta - string: amount of token1 delta

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Swap" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "Swap" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

UpgradeImpl

func UpgradeImpl(cur realm, packagePath string)

UpgradeImpl switches the active pool implementation to a different version. This function allows seamless upgrades from one version to another without data migration or downtime. Security: Only admin or governance can perform upgrades. The new implementation must have been previously registered via RegisterInitializer.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/pool" -func "UpgradeImpl" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

NewPoolStore

func NewPoolStore(kvStore store.KVStore) IPoolStore

NewPoolStore creates a new pool store instance with the provided KV store. This function is used by the upgrade system to create storage instances for each implementation.

Param

Command

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

Result

NewDefaultObservation

func NewDefaultObservation() *Observation

Command

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

Result

NewObservation

func NewObservation( blockTimestamp int64, tickCumulative int64, liquidityCumulative *u256.Uint, secondsPerLiquidityCumulativeX128 *u256.Uint, initialized bool, ) *Observation

Params

Command

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

Result

GetObservationState

func GetObservationState(poolPath string) (*ObservationState, error)

GetObservationState returns the observation state for a given pool path.

Param

Command

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

Result

NewObservationState

func NewObservationState(currentTime int64) *ObservationState

Param

Command

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

Result

GetPool

func GetPool(token0Path, token1Path string, fee uint32) (*Pool, error)

GetPool returns a copy of the pool for the given token pair and fee tier.

Params

Command

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

Result

NewPool

func NewPool( token0Path string, token1Path string, fee uint32, sqrtPriceX96 *u256.Uint, tickSpacing int32, tick int32, slot0FeeProtocol uint8, maxLiquidityPerTick *u256.Uint, ) *Pool

Params

Command

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

Result

GetPosition

func GetPosition(poolPath, key string) (PositionInfo, error)

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.GetPosition(,)"

Result

NewDefaultPositionInfo

func NewDefaultPositionInfo() PositionInfo

Command

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

Result

NewPositionInfo

func NewPositionInfo( liquidity *u256.Uint, feeGrowthInside0LastX128 *u256.Uint, feeGrowthInside1LastX128 *u256.Uint, tokensOwed0 *u256.Uint, tokensOwed1 *u256.Uint, ) PositionInfo

Params

Command

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

Result

GetTickInfo

func GetTickInfo(poolPath string, tick int32) (TickInfo, error)

GetTickInfo returns the tick info for a given tick.

Params

Command

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

Result

NewTickInfo

func NewTickInfo() TickInfo

Command

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

Result

NewTokenPair

func NewTokenPair(token0, token1 *u256.Uint) TokenPair

Params

Command

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

Result