Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

pool/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. Parameters:

  • token0Path: first token contract path; pool paths canonicalize token order.
  • token1Path: second token contract path; pool paths canonicalize token order.
  • fee: fee tier encoded in the pool identifier.

Returns:

  • poolPath: canonical token0:token1:fee pool identifier.

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/pool/v1.GetPoolPath(,,)"

Result

NewPoolV1

func NewPoolV1(store pool.IPoolStore) pool.IPool

NewPoolV1 constructs the version-one pool implementation around shared persistent storage.

Parameters:

  • store: pool-domain storage implementation used by the returned API.

Returns:

  • implementation: IPool backed by store.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/pool/v1.NewPoolV1()"

Result

NewTickEventInfo

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

NewTickEventInfo creates event data for one tick and its persisted state.

Parameters:

  • tickID: tick index represented by the event.
  • tickInfo: tick state whose fields are serialized by ToString.

Returns:

  • *tickEventInfo: event information value retaining the supplied tick index and state.

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/gnoswap/pool/v1.NewTickEventInfo(,)"

Result