Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

limit package

Overview

Package limit is the GnoSwap limit order realm.

Users escrow makingAmount of tokenIn for takingAmount of tokenOut before expiresAt. Authorized keepers fill orders on a whitelisted direct pool, without the router, choosing the pool fee tier and swap price limit for each fill. Partial fills leave unsold input in escrow; each fill pays the owner immediately after deducting the order's snapshotted execution fee, while enforcing the order's slippage-adjusted owner-net exchange ratio. Owners can cancel for the remaining input, and anyone can refund expired orders through bounded cleanup. Settled orders are removed from the indexes.

This package is the permanent entry point. It owns the escrow address, the KV store shared by every version, and the upgrade switch; the business logic lives in a registered implementation (impl/v0).

Files:

  • proxy.gno: state-changing entry points
  • getter.gno: read-only queries
  • store.gno: KV store and store keys
  • state.gno: realm state and the active implementation
  • upgrade.gno: implementation registration and upgrades
  • swap_callback.gno: authenticated pool callback paying escrowed input

Function

CancelOrder

func CancelOrder(cur realm, orderID uint64) int64
Ask AI Claude ChatGPT

CancelOrder refunds the remaining input and removes the order from the indexes. A past-deadline refund uses the expired event. It returns the refunded input.

Owner only. Reverts while withdrawals are halted for limit orders.

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

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/gnoswap/order/limit, for example a function call with arguments.