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

common package

Overview

Package common provides shared realm utilities for GnoSwap protocol contracts.

The package contains helpers that must keep a realm boundary, including GRC20 token operations and native coin validation. AMM math lives in gno.land/p/gnoswap/gnsmath/v1.

Key components: - GRC20 Registry Helpers: convenient wrappers for GRC20 token operations - Coin Utilities: native coin handling and validation - Assertion Utilities: input validation for supported operations, including native-coin rejection

Function

SafeGRC20TransferFrom

func SafeGRC20TransferFrom(_ int, rlm realm, tokenKey string, from, to address, amount int64)

SafeGRC20TransferFrom transfers tokens as the current realm and panics if it fails.

Parameters:

  • _: leading integer discriminator for the realm-crossing ABI; pass 0.
  • rlm: propagated realm context used to resolve and invoke the registered token implementation.
  • tokenKey: registry key identifying the GRC20 token to transfer.
  • from: address whose allowance and balance are debited.
  • to: recipient address.
  • amount: number of token base units to transfer.

Panics if the underlying transfer returns an error.

Params

Command

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

Result