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

grc20wrapdemo/v0 package

Overview

Package grc20wrapdemo is a permissionless wrapper factory for GRC20 tokens.

Point it at any token registered in gno.land/r/nt/grc20reg/v0 and it issues a new one backed by it, with a personality you pick from a list. Point it at two and it issues a meta-token backed by both. Nothing is whitelisted, nothing is owned, and the realm never gains authority over anybody's balance: every deposit is pulled with an allowance the holder granted to this realm's address.

The five wrapper modes, all from gno.land/p/moul/x/grc20wrap/v0:

Example
1plain      1:1 custody. A receipt. The boring one that proves the rest works.
2kilo       1 underlying unit becomes 1000 wrapped ones, +3 decimals.
3soulbound  wrap and unwrap freely, but the wrapped token never changes hands.
4pool       shares in the escrow: Donate raises what every share redeems for.
5sticky     pool, plus a 1% exit fee that stays behind for whoever holds on.

And one fusion mode: NewFusion bundles two registered tokens at a fixed proportion into a single meta-token, redeemable back into both.

Wrapping a wrapper

Every token this realm issues is itself registered in grc20reg, so its key can be fed straight back into NewWrapper or NewFusion. A pool over a kilo over a plain wrap of RED is legal, works, and is a good way to see how thin the abstraction really is.

The one thing a caller must do first

Approve this realm's address on the underlying token, through THAT token's own realm. Home() prints the address. Without it every Deposit fails with "insufficient allowance", which is the system working.

Play money to try it on: gno.land/r/moul/x/grc20faucet/v0.

Function

Transfer

func Transfer(cur realm, symbol string, to address, amount int64)

Transfer moves the caller's own units of `symbol`. A soulbound wrapper refuses here, and nowhere else.

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/moul/x/grc20wrapdemo/v0" -func "Transfer" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/grc20wrapdemo/v0" -func "Transfer" -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 "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx