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 package

Overview

Package router provides swap routing and execution across GnoSwap liquidity pools.

Router domain proxy for single-hop and multi-hop exact-in, exact-out, and dry-route operations.

Live exact-in and exact-out calls validate a deadline and the corresponding amount limit (minimum output or maximum input). DrySwapRoute is a read-only quote path with no deadline or token transfer.

The router fee is charged on output tokens. It defaults to 15 bps (0.15%) and is configurable by admin/governance from 0 through 1000 bps (0–10%); the current rate is fixed for each individual execution.

The router acts as a proxy to version-specific implementations, currently routing to v1 for all swap operations.

Function

DrySwapRoute

func DrySwapRoute( inputToken, outputToken string, specifiedAmount string, swapTypeStr string, strRouteArr, quoteArr string, tokenAmountLimit string, ) (string, string, error)

DrySwapRoute simulates a swap route without changing state.

Parameters:

  • inputToken: input token path
  • outputToken: output token path
  • specifiedAmount: exact input or output amount
  • swapTypeStr: `EXACT_IN` or `EXACT_OUT`
  • strRouteArr: encoded route
  • quoteArr: encoded quotes
  • tokenAmountLimit: minimum output or maximum input amount

Returns:

  • amountIn: estimated input amount
  • amountOut: estimated output amount
  • err: non-nil when route validation or simulation fails

Params

Command

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

Result