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

router/v1 package

Overview

package v1 handles token swaps through GnoSwap liquidity pools.

The router provides user-facing swap functions with slippage protection, multi-hop routing, and automatic GNOT wrapping/unwrapping. It supports both exact input and exact output swap modes.

All swap functions include deadline checks and minimum output validation to protect users from unfavorable price movements.

Function

BuildSingleHopRoutePath

func BuildSingleHopRoutePath(tokenA, tokenB string, fee uint32) string

BuildSingleHopPath creates a single-hop route path string. Format: "tokenA:tokenB:fee"

Parameters: - tokenA: input token address - tokenB: output token address - fee: pool fee (e.g., 500, 3000, 10000)

Returns: - string: formatted single-hop route path

Example:

  • BuildSingleHopPath("gno.land/r/demo/wugnot", "gno.land/r/demo/usdc", 500) returns "gno.land/r/demo/wugnot:gno.land/r/demo/usdc:500"

Params

Command

gnokey query vm/qeval -remote "https://rpc.topaz.testnets.gno.land" -data "gno.land/r/gnoswap/router/v1.BuildSingleHopRoutePath(,,)"

Result