Search Apps Documentation Source Content File Folder Download Copy Actions Download

limitspike package

Overview

Package limitspike is a throwaway spike proving the make-or-break leg of a GnoPulse limit-order product: that a realm can (a) read GnoSwap's live pool tick on-chain to GATE execution, and (b) execute a swap on GnoSwap *on a user's behalf* — the realm holds the tokens (pulled from the user via GRC20 allowance), is the swap payer, receives the output, and forwards it back.

Confirmed against GnoSwap on test-13:

  • router debits the immediate calling realm (PreviousRealm), not the EOA, so delegated execution works;
  • native ugnot is rejected on the swap tx — the GNOT side must be wugnot;
  • the GRC20 allowance spender for the swap is the router role address.

Functions

Execute

func Execute(cur realm, amountIn int64, minTick int32, minOut int64) (int32, int64)

Execute runs one delegated limit swap of `amountIn` wugnot -> GNS for the caller.

Preconditions (set by the caller in prior txs):

  • caller holds >= amountIn wugnot (wrap ugnot via wugnot.Deposit first);
  • caller has Approve'd THIS realm as spender for >= amountIn wugnot.

The limit gate: execution is refused unless the live pool tick >= minTick. (minTick is the on-chain, MEV-safe trigger — the realm re-checks it itself, so a keeper poking this function can never force an off-limit fill.)

minOut is the slippage floor (amountOutMin) passed to GnoSwap. Returns (tickAtExecution, gnsForwardedToCaller).

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/limitspike" -func "Execute" -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/limitspike" -func "Execute" -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
  

Render

func Render(_ string) string

Param

Command

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

Result

Tick

func Tick() int32

Tick returns the live GnoSwap pool tick — the trigger signal. Read-only.

Command

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

Result