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 package

Function

DrySwap

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

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 in the pool pair.
  • token1Path: Path of the second token in the pool pair.
  • fee: Fee tier identifying the pool.
  • zeroForOne: True to sell token0 for token1; false to sell token1 for token0.
  • amountSpecified: Decimal signed amount; positive requests exact input and negative requests exact output.
  • sqrtPriceLimitX96: Price boundary in Q64.96 fixed-point form at which the simulation must stop.

Returns:

  • amount0: Simulated signed token0 delta, as a decimal string; "0" on an unsuccessful simulation.
  • amount1: Simulated signed token1 delta, as a decimal string; "0" on an unsuccessful simulation.
  • error: Nil when the simulation succeeds; non-nil when validation, computation, or pool-balance checks fail.

Params

Command

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

Result