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

nft source realm

Package nft holds GnoRadio's concert tickets as GRC721 NFTs. It is permanent, like the data realm: a tickets release ...

Overview

Package nft holds GnoRadio's concert tickets as GRC721 NFTs. It is permanent, like the data realm: a tickets release changes the rules, never this ledger, so no ticket ever moves to a new contract.

Only the realm that writes the tickets role now (data.Writer("tickets")) mints and transfers, only while that role is not paused, and only for the wallet that signs the transaction (OriginCaller): a release can never move the ticket of a holder who signs nothing. That is the whole guarantee. The signature proves the holder sent some transaction through the tickets writer, not that they asked for this move: a malicious tickets release (it takes over only after the data realm's public 72 h window, which the guardian can cancel) could move every ticket of a holder who then signs any call to it. This realm cannot see further up the call stack. Anyone reads.

A ticket's metadata and artwork are drawn on the fly from the tickets data (art.gno), whose record layout below is frozen for that reason.

Constants 4

const CEvents, CTickets, Chunk

1const (
2	CEvents  = "tickets/events"  // store.Pad(id) -> event record
3	CTickets = "tickets/tickets" // store.Pad((id-1)/Chunk) -> Chunk ticket records
4	Chunk    = 16
5)
source

The tickets records this realm reads, written by the tickets writer. Every tickets release keeps this layout: the artwork of existing tickets depends on it.

const CArtists, ArtistChunk, AHidden, AName

1const (
2	CArtists    = "catalog/artists" // store.Pad((id-1)/ArtistChunk) -> ArtistChunk artist heads
3	ArtistChunk = 8
4	AHidden     = 0 // "1" or ""
5	AName       = 6
6)
source

The catalog's artist heads, read for a ticket's artist line: every catalog release keeps this layout, since it shares the data realm's records (catalog/v1 records.gno). Reading them here, not through a catalog realm, keeps this permanent realm free of any versioned import.

Functions 11

func ArtistName

Action
1func ArtistName(id int) string
source

ArtistName is a visible artist's name, "" otherwise (one data read: the catalog's artist record, through the frozen layout).

func EventSVG

Action
1func EventSVG(id int) string
source

EventSVG is the specimen ticket of a visible concert as a markdown image, or "" when the concert is not visible.

func Mint

crossing Action
1func Mint(cur realm, to address, id int)
source

Mint creates ticket id for to, the wallet that signed the transaction. The tickets writer only.

func Render

1func Render(_ string) string
source

Render shows the collection.

func TicketSVG

Action
1func TicketSVG(id int) string
source

TicketSVG is a ticket as a markdown image, or "" if unknown.

func TokenURI

Action
1func TokenURI(tokenID string) string
source

TokenURI is a ticket's GRC721 metadata as a data URI, its artwork drawn on the fly. It panics for an unknown ticket.

func Transfer

crossing Action
1func Transfer(cur realm, from, to address, id int)
source

Transfer moves ticket id from its holder from to to. The tickets writer only, and only in a transaction from signed: no release moves the tickets of a holder who signs nothing (see the package comment for what a malicious release could still do). The rules decide who may gift.

Imports 10

Source Files 3