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

v0 source realm

Functions 8

func Approve

Action
1func Approve(_ int, rlm realm, tokenKey string, spender address, amount int64)
source

Approve sets an allowance owned by the CALLING REALM, letting `spender` draw on the calling realm's balance. It does not touch the signing user's allowances.

func Register

crossing Action
1func Register(cur realm, token *grc20.Token, slug string) string
source

Register records token under its rlmPath.symbol key and returns that key. Token.ID() carries a trailing sequence id (rlmPath.symbol.<id>) that keeps token identities/events unique, but the registry deliberately keys by rlmPath.symbol so lookups don't need to know the id, and so a realm cannot register two tokens under the same symbol (overwrite/alias guard).

func Transfer

Action
1func Transfer(_ int, rlm realm, tokenKey string, to address, amount int64)
source

Transfer moves `amount` out of the CALLING REALM's own balance.

Call it non-crossing, forwarding your own `cur`:

Example
1grc20reg.Transfer(0, cur, "gno.land/r/demo/defi/foo20.FOO", to, 100)

func TransferFrom

Action
1func TransferFrom(_ int, rlm realm, tokenKey string, from, to address, amount int64)
source

TransferFrom spends an allowance with the CALLING REALM as the spender.

Note the allowance direction this implies: `from` must have approved the calling realm, not the signing user. That is the supported way for a realm to move a user's funds — the user grants the realm an allowance, and the realm draws on it as itself, so every debit is one the owner authorized against that specific realm.

Imports 8

Source Files 3