Search Apps Documentation Source Content File Folder Download Copy Actions Download

dexprobe package

Overview

Package dexprobe is a one-shot feasibility probe: it exercises every GnoSwap primitive an on-chain order engine (DCA / limit / stop-loss, keeper-driven, non-custodial or vault-funded) would ever need, so the real build is derisked in a single deploy. Each exported fn answers one unknown; a harness drives the multi-tx cases. Throwaway test realm — no product code here.

Functions

BestTier

func BestTier(a, b string) string

BestTier scans the fee tiers for the deepest pool of a pair (tier-selection).

Params

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.BestTier(,)"

Result

BuyExactGns

func BuyExactGns(cur realm, amountOut, amountInMax int64) int64

BuyExactGns: ExactOut — buy exactly amountOut GNS, spending <= amountInMax wugnot, refunding the unused wugnot. Returns actual wugnot spent.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "BuyExactGns" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "BuyExactGns" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

BuyGns

func BuyGns(cur realm, amountIn, minOut int64) int64

BuyGns: WG -> GNS (baseline, allowance-funded). Returns GNS out.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "BuyGns" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "BuyGns" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

Cardinality

func Cardinality() string

Cardinality reports the pool's observation-buffer size (1 = un-warmed → no TWAP).

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.Cardinality()"

Result

Counter

func Counter() int

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.Counter()"

Result

DryQuote

func DryQuote(amountIn int64) string

DryQuote calls GnoSwap's read-only quote FROM inside a realm (the slippage-floor dependency). Returns the expected GNS out for amountIn wugnot.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.DryQuote()"

Result

FailAtomic

func FailAtomic(cur realm, amountIn int64)

FailAtomic bumps the counter then forces a swap revert (impossible minOut). The whole tx must revert → Counter() stays unchanged, proving state rolls back on a failed fill.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "FailAtomic" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "FailAtomic" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

FeeSkimBuy

func FeeSkimBuy(cur realm, amountIn, feeBps int64, treasury address) int64

FeeSkimBuy buys GNS, then skims feeBps of the output to `treasury` (revenue model).

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "FeeSkimBuy" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "FeeSkimBuy" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

FloorBuy

func FloorBuy(cur realm, amountIn, maxSlippageBps int64) int64

FloorBuy: the on-chain slippage-floor design. Quote GnoSwap for THIS size, derive minOut = expected*(1-maxSlippageBps) ON-CHAIN, then swap. Keeper can't set the floor.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "FloorBuy" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "FloorBuy" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

Fund

func Fund(cur realm)

Fund lets the harness deposit native ugnot into this realm (for tip/native-send probes).

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "Fund" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "Fund" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

GrowCardinality

func GrowCardinality(cur realm, cardNext uint16)

GrowCardinality warms the TWAP buffer (Uniswap-v3 style). Crossing fn.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "GrowCardinality" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "GrowCardinality" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

MultiHopBuy

func MultiHopBuy(cur realm, amountIn, minOut int64) string

MultiHopBuy: WG -> USDC -> DAI (2 hops). Returns DAI out (string, from the router). DAI stays in the realm (no DAI import needed to prove multi-hop works).

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "MultiHopBuy" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "MultiHopBuy" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

Render

func Render(_ string) string

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.Render()"

Result

SellGns

func SellGns(cur realm, amountGns, minOut int64) int64

SellGns: GNS -> WG (proves the SELL side). Returns wugnot out.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "SellGns" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "SellGns" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

SellGnsToNative

func SellGnsToNative(cur realm, amountGns, minOut int64) int64

SellGnsToNative: sell GNS, unwrap wugnot -> native ugnot, deliver via banker.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "SellGnsToNative" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "SellGnsToNative" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

SpotSqrtPrice

func SpotSqrtPrice() string

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.SpotSqrtPrice()"

Result

SpotTick

func SpotTick() int32

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.SpotTick()"

Result

TipKeeper

func TipKeeper(cur realm, amount int64)

TipKeeper pays the caller `amount` ugnot from the realm's native balance (the permissionless-keeper payment mechanic). Realm must be pre-Funded.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "TipKeeper" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "TipKeeper" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

TwapProbe

func TwapProbe(secondsAgo uint32) string

TwapProbe answers the #1 unknown: does a manipulation-resistant TWAP work? Returns "tick=<t> liq=<l> err=<e>". On un-warmed pools err is non-nil.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.TwapProbe()"

Result

VaultBalance

func VaultBalance(owner address) int64

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe.VaultBalance()"

Result

VaultDeposit

func VaultDeposit(cur realm, amount int64)

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "VaultDeposit" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "VaultDeposit" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

VaultSwapBuy

func VaultSwapBuy(cur realm, owner address, amountIn, minOut int64) int64

VaultSwapBuy: keeper-callable, draws from the owner's vault balance (not allowance), swaps, forwards GNS to owner. `owner` is an arg because the keeper (not owner) calls.

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "VaultSwapBuy" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "VaultSwapBuy" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

VaultWithdraw

func VaultWithdraw(cur realm, amount int64)

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/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "VaultWithdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1cz86tl8vnh9956cpuu43ksjy7kmur745wdjxsc/dexprobe" -func "VaultWithdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx