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

goldenticket package

Overview

Package goldenticket is a 1/1 GRC721 NFT: one golden ticket, minted to the publisher when the package is added. It exists to check that a gno.land collection shows in the Adena wallet before gnofly's planes go to mainnet, so it is built the way the planes are:

  • the collection is a gno.land/p/nt/grc721/v0 token made with NewToken, whose NewToken and Transfer events Adena finds on its indexer;
  • the read functions take a grc721.TokenID and return (value, error), as Adena calls them: OwnerOf("1"), BalanceOf("g1..."), TokenURI("1") as the <img src>, TokenMetadata("1") as JSON with camelCase traitType.

Transfer moves the ticket, so it can reach any Adena account.

Functions

BalanceOf

func BalanceOf(addr address) (int64, error)

BalanceOf returns 1 for the holder of the ticket, 0 for everyone else.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket.BalanceOf()"

Result

Name

func Name() string

Name and Symbol, as GRC721 tokens have them. Adena reads both from the NewToken event.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket.Name()"

Result

Render

func Render(_ string) string

Render shows the ticket and who holds it.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket.Render()"

Result

Symbol

func Symbol() string

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket.Symbol()"

Result

TokenMetadata

func TokenMetadata(tid grc721.TokenID) (string, error)

TokenMetadata returns the metadata of the ticket as JSON, with the keys Adena reads.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket.TokenMetadata()"

Result

TokenURI

func TokenURI(tid grc721.TokenID) (string, error)

TokenURI returns the image of the ticket: what Adena shows.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket.TokenURI()"

Result

Transfer

func Transfer(cur realm, to address)

Transfer gives the ticket to someone else. Only its holder can, by a direct call (maketx call or Adena), not through another realm.

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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket" -func "Transfer" -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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/goldenticket" -func "Transfer" -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