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

skins state

Back to all declarations

Buy

func(skinID string) int64

Buy buys one token of a skin design for the caller and returns its id. The exact price must be attached to the transaction (-send "\<price>ugnot") and is forwarded to the treasury of the game realm before the call returns. An address owns at most one token of a design: a skin cannot be given away, so a second copy would be of no use. It must be called directly by a user (maketx call): a call relayed by another realm or by a maketx run script is refused.

Open
OID
0ab54f…c6d1:3
Buy details

Inspect func

Burn

func(id int64)

Burn destroys a skin token. Only its owner can. The storage deposit paid at purchase comes back; the price does not. The owner can buy the design again, while it is listed.

Open
OID
0ab54f…c6d1:5
Burn details

Inspect func

ownedKey

func(addr .uverse.address, skinID string) string

ownedKey is the key of owned: the address, then the design.

Open
OID
0ab54f…c6d1:6
ownedKey details

Inspect func

skinOf

func(id int64) string

skinOf returns the design of token id, "" when there is no such token.

Open
OID
0ab54f…c6d1:7
skinOf details

Inspect func

ownerOf

func(id int64) .uverse.address
Open
OID
0ab54f…c6d1:8
ownerOf details

Inspect func

catalog

untyped string

catalog is the skin catalog at deploy, one design per line, sorted by id: id|name|model|pilot|body|wing|accent|price The rules are those of SetSkin (see validate.gno); the tests check every line. The website reads this file too, at build, to serve the metadata of each design at [https://gnofly.xyz/nft/skins/](https://gnofly.xyz/nft/skins/)\<id>.json: a design added later with SetSkin needs a line here as well for its JSON to exist. Classic, the look every pilot flies by default, is not here: it is free and drawn by the client, not a token.

Value

"baron|Red Baron|biplane|none|#c1121f|#780000|#fdf0d5|7000000\ngnome|Garden Gnome|prop|none|#2a9d8f|#e9c46a|#264653|77000000\ngoldie|Golden Goose|jet|none|#ffd60a|#ffc300|#000814|7777000000\nstealth|Night Shift|jet|none|#22223b|#4a4e69|#f72585|777000000"

errSpoofedRealm

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: spoofed realm"

errNotAdmin

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: caller is not an admin"

errBadCatalog

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: corrupt catalog line"

errInvalidID

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: id must be 1 to 32 characters of [a-z0-9-]"

errReservedID

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: classic is the free look of every pilot, not a skin to sell"

errInvalidName

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: name must be 1 to 40 characters of [A-Za-z0-9 '.!-]"

errInvalidModel

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: model must be 1 to 16 characters of [a-z0-9-]"

errInvalidPilot

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: pilot must be none or gnome"

errInvalidColor

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: colors must be #rrggbb in lowercase"

errInvalidPrice

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: price must be between 1 and 1000000000000 ugnot"

errInvalidSupply

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: max supply must be 0 (unlimited) or more"

errUnknownSkin

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: unknown skin"

errSkinUnlisted

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: this skin is not for sale"

errSoldOut

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: every copy of this skin is sold"

errAlreadyOwned

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: this address already owns this skin"

errNotUserCall

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: Buy must be called directly by a user (maketx call)"

errNotMinted

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: no such skin token"

errNotSkinOwner

untyped string

The refusals of this realm, as string constants: a string costs its length in storage where an errors.New value costs about 1.15 KB (see the planes realm). A panic with a string aborts the call with the same message.

Value

"gnofly: caller does not own this skin token"

CatalogJSON

func() string

CatalogJSON returns every design, sorted by id, as a JSON array: [ { "id": "baron", "name": "Red Baron", "model": "biplane", "pilot": "none", "body": "#c1121f", "wing": "#780000", "accent": "#fdf0d5", "price": 1000000, "listed": true, "minted": 3, "maxSupply": 0 } ] The output has no whitespace. maxSupply 0 is unlimited. Classic, the free look, is not in it: the client draws it without a token.

Open
OID
0ab54f…c6d1:9
CatalogJSON details

Inspect func

SkinsOf

func(addr .uverse.address) string

SkinsOf returns the designs addr owns a token of, sorted by id, as a JSON array: \["baron","goldie"]. It is \[] for an address without skins.

Open
OID
0ab54f…c6d1:11
SkinsOf details

Inspect func

OwnerOf

func(tid v0.TokenID) (.uverse.address, .uverse.error)
Open
OID
0ab54f…c6d1:12
OwnerOf details

Inspect func

BalanceOf

func(addr .uverse.address) (int64, .uverse.error)

BalanceOf returns how many skin tokens addr owns, one per design at most.

Open
OID
0ab54f…c6d1:13
BalanceOf details

Inspect func

TokenMetadata

func(tid v0.TokenID) (string, .uverse.error)

TokenMetadata returns the metadata of skin token tid as JSON, the same for every token of a design, with the keys Adena reads: {"name":"Red Baron","description":"A gnofly skin, a biplane. ...", "image":"https://gnofly.xyz/nft/skins/baron.png", "attributes":[{"traitType":"model","value":"biplane"}, ...]}

Open
OID
0ab54f…c6d1:14
TokenMetadata details

Inspect func

mintedID

func(tid v0.TokenID) (int64, .uverse.error)

mintedID reads a token id, "1" and up in decimal, and checks it exists.

Open
OID
0ab54f…c6d1:15
mintedID details

Inspect func

SkinOf

func(id int64) string

SkinOf returns the design of skin token id, "" when there is no such token.

Open
OID
0ab54f…c6d1:16
SkinOf details

Inspect func

TokenURI

func(tid v0.TokenID) (string, .uverse.error)

TokenURI returns the image of skin token tid, "[https://gnofly.xyz/nft/skins/](https://gnofly.xyz/nft/skins/)\<design>.png": what a wallet shows (Adena puts it in an \<img>). The metadata is TokenMetadata, or "[https://gnofly.xyz/nft/skins/](https://gnofly.xyz/nft/skins/)\<design>.json" on the website. It is computed, not stored: a token costs no URI in deposit.

Open
OID
0ab54f…c6d1:17
TokenURI details

Inspect func

encode

func(n *v0.Node) string

encode marshals a document built above; it cannot fail on one.

Open
OID
0ab54f…c6d1:18
encode details

Inspect func

Render

func(path string) string

Render returns the shop as markdown, for gnoweb: "" the catalog "skin/<id>" one design "player/<addr>" the skins of one address Everything printed went through validate.gno when it was written, or is an address the chain gave the realm; the caller-supplied id and address are printed only once found valid.

Open
OID
0ab54f…c6d1:19
Render details

Inspect func

renderDesign

func(d *skins.design) string
Open
OID
0ab54f…c6d1:23
renderDesign details

Inspect func

renderPlayer

func(addr .uverse.address) string
Open
OID
0ab54f…c6d1:24
renderPlayer details

Inspect func

supplyText

func(n int64) string
Open
OID
0ab54f…c6d1:26
supplyText details

Inspect func

gnot

func(ugnot int64) string

gnot writes ugnot as GNOT: 1000000 -> "1 GNOT", 1500000 -> "1.5 GNOT".

Open
OID
0ab54f…c6d1:27
gnot details

Inspect func

authority

type

authority is the set of questions this realm asks about roles.

Value

skins.authority

gameRoles

type

gameRoles answers with the roles of the game realm.

Value

skins.gameRoles

roles

skins.gameRoles

roles is the authority of this realm: the game realm, always. It is a variable for one reason. Under \`gno test\` an imported realm is initialized without a deployer, and a test of this package has no way to become an admin of the game realm, so the tests put their own answers here. Nothing outside the test files assigns it, and there is no setter.

Open
OID
0ab54f…c6d1:30
roles details

Inspect ref

callerOf

func(int, rlm .uverse.realm) .uverse.address
Open
OID
0ab54f…c6d1:31
callerOf details

Inspect func

assertAdmin

func(int, rlm .uverse.realm) .uverse.address
Open
OID
0ab54f…c6d1:33
assertAdmin details

Inspect func

design

type

design is one skin of the catalog: what it looks like and how it sells.

Value

skins.design

token

*v0.Token

The state. Nothing is exported by reference: the ledger and the trees are /p/ types with mutator methods. The token itself is not exported either: its tellers move tokens, and a skin never moves (soulbound, see doc.gno).

Open
OID
0ab54f…c6d1:64
token details

Inspect pointer

ledger

*v0.PrivateLedger

The state. Nothing is exported by reference: the ledger and the trees are /p/ types with mutator methods. The token itself is not exported either: its tellers move tokens, and a skin never moves (soulbound, see doc.gno).

Open
OID
0ab54f…c6d1:66
ledger details

Inspect pointer

designs

v0.BPTree

// design id -> \*design

Open
OID
0ab54f…c6d1:72
designs details

Inspect ref

tokenSkin

v0.BPTree

// token id -> design id

Open
OID
0ab54f…c6d1:89
tokenSkin details

Inspect ref

owned

v0.BPTree

// "\<addr>/\<design>" -> token id

Open
OID
0ab54f…c6d1:90
owned details

Inspect ref

nextID

int64

// the id of the next token, 1 first

Value

4

webPath

string

// "/r/.../gnofly/nfts/skins", for the links of Render

Value

"/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/nfts/skins"

tokenName

untyped string

Value

"gnofly skins"

tokenSymbol

untyped string

Value

"SKIN"

payDenom

untyped string

Value

"ugnot"

maxPrice

int64

Value

1000000000000

uriBase

untyped string

Value

"https://gnofly.xyz/nft/skins/"

classic

untyped string

// the free look, never a token

Value

"classic"

bootstrap

func(int, rlm .uverse.realm)

bootstrap (re)creates the state and seeds the catalog. The tests call it to start over.

Open
OID
0ab54f…c6d1:46
bootstrap details

Inspect func

getDesign

func(id string) *skins.design

getDesign returns the design registered under id, or nil.

Open
OID
0ab54f…c6d1:47
getDesign details

Inspect func

putDesign

func(id string, name string, model string, pilot string, body string, wing string, accent string, price int64, maxSupply int64)

putDesign validates and stores a design. An existing one keeps its count and its listed flag; a new one starts listed.

Open
OID
0ab54f…c6d1:48
putDesign details

Inspect func

SetSkin

func(id string, name string, model string, pilot string, body string, wing string, accent string, price int64, maxSupply int64)

SetSkin creates or updates a design. Admin only. id is \[a-z0-9-]{1,32} and not "classic", name \[A-Za-z0-9 '.!-]{1,40}, model \[a-z0-9-]{1,16}, pilot none or gnome, colours "#rrggbb" in lowercase, price 1 to 1e12 ugnot, maxSupply 0 for unlimited. A max supply under what is already minted stops the sales, it takes nothing back. Owners keep their tokens whatever happens to the design; its look is read from here, so a change of colours repaints every copy.

Open
OID
0ab54f…c6d1:49
SetSkin details

Inspect func

SetSkinListed

func(id string, listed bool)

SetSkinListed puts a design on or off sale. Admin only.

Open
OID
0ab54f…c6d1:50
SetSkinListed details

Inspect func

webPathOf

func(pkgPath string) string

webPathOf turns "gno.land/r/..." into "/r/...".

Open
OID
0ab54f…c6d1:51
webPathOf details

Inspect func

boolString

func(b bool) string
Open
OID
0ab54f…c6d1:53
boolString details

Inspect func

maxIDLen

untyped bigint

Value

(32 <untyped> bigint)

maxModelLen

untyped bigint

Value

(16 <untyped> bigint)

maxNameLen

untyped bigint

Value

(40 <untyped> bigint)

validID

func(s string) bool

validID reports whether s matches \[a-z0-9-]{1,32}.

Open
OID
0ab54f…c6d1:54
validID details

Inspect func

validModel

func(s string) bool

validModel reports whether s matches \[a-z0-9-]{1,16}.

Open
OID
0ab54f…c6d1:56
validModel details

Inspect func

validName

func(s string) bool

validName reports whether s matches \[A-Za-z0-9 '.!-]{1,40}. The charset is deliberately narrow so that a name can be embedded in JSON and markdown without escaping.

Open
OID
0ab54f…c6d1:57
validName details

Inspect func

validColor

func(s string) bool

validColor reports whether s is "#rrggbb" with lowercase hex digits.

Open
OID
0ab54f…c6d1:58
validColor details

Inspect func

validAddress

func(addr .uverse.address) bool

validAddress reports whether addr is a valid address in its canonical, lowercase form. Bech32 can also be written in all capitals, and address.IsValid accepts that. To this realm the capitals would be a second key for the same account: a second player record, a second line on a leaderboard, an admin who can never be matched to a caller. Bech32 does not allow mixing cases, so looking at the first character is enough.

Open
OID
0ab54f…c6d1:59
validAddress details

Inspect func

isSlug

func(s string, max int) bool

isSlug reports whether s is 1 to max characters of \[a-z0-9-].

Open
OID
0ab54f…c6d1:60
isSlug details

Inspect func
Buy : func(skinID string) int64 Inspect
Burn : func(id int64) Inspect
ownedKey : func(addr .uverse.address, skinID string) string Inspect
skinOf : func(id int64) string Inspect
ownerOf : func(id int64) .uverse.address Inspect
catalog : untyped string ="baron|Red Baron|biplane|none|#c1121f|#780000|#fdf0d5|7000000\ngnome|Garden Gnome|prop|none|#2a9d8f|#e9c46a|#264653|77000000\ngoldie|Golden Goose|jet|none|#ffd60a|#ffc300|#000814|7777000000\nstealth|Night Shift|jet|none|#22223b|#4a4e69|#f72585|777000000"
errSpoofedRealm : untyped string ="gnofly: spoofed realm"
errNotAdmin : untyped string ="gnofly: caller is not an admin"
errBadCatalog : untyped string ="gnofly: corrupt catalog line"
errInvalidID : untyped string ="gnofly: id must be 1 to 32 characters of [a-z0-9-]"
errReservedID : untyped string ="gnofly: classic is the free look of every pilot, not a skin to sell"
errInvalidName : untyped string ="gnofly: name must be 1 to 40 characters of [A-Za-z0-9 '.!-]"
errInvalidModel : untyped string ="gnofly: model must be 1 to 16 characters of [a-z0-9-]"
errInvalidPilot : untyped string ="gnofly: pilot must be none or gnome"
errInvalidColor : untyped string ="gnofly: colors must be #rrggbb in lowercase"
errInvalidPrice : untyped string ="gnofly: price must be between 1 and 1000000000000 ugnot"
errInvalidSupply : untyped string ="gnofly: max supply must be 0 (unlimited) or more"
errUnknownSkin : untyped string ="gnofly: unknown skin"
errSkinUnlisted : untyped string ="gnofly: this skin is not for sale"
errSoldOut : untyped string ="gnofly: every copy of this skin is sold"
errAlreadyOwned : untyped string ="gnofly: this address already owns this skin"
errNotUserCall : untyped string ="gnofly: Buy must be called directly by a user (maketx call)"
errNotMinted : untyped string ="gnofly: no such skin token"
errNotSkinOwner : untyped string ="gnofly: caller does not own this skin token"
CatalogJSON : func() string Inspect
SkinsOf : func(addr .uverse.address) string Inspect
OwnerOf : func(tid v0.TokenID) (.uverse.address, .uverse.error) Inspect
BalanceOf : func(addr .uverse.address) (int64, .uverse.error) Inspect
TokenMetadata : func(tid v0.TokenID) (string, .uverse.error) Inspect
mintedID : func(tid v0.TokenID) (int64, .uverse.error) Inspect
SkinOf : func(id int64) string Inspect
TokenURI : func(tid v0.TokenID) (string, .uverse.error) Inspect
encode : func(n *v0.Node) string Inspect
Render : func(path string) string Inspect
renderHome : func() string Inspect
renderDesign : func(d *skins.design) string Inspect
renderPlayer : func(addr .uverse.address) string Inspect
supplyText : func(n int64) string Inspect
gnot : func(ugnot int64) string Inspect
yesNo : func(b bool) string Inspect
authority : type =skins.authority
gameRoles : type =skins.gameRoles
roles : skins.gameRoles Inspect
callerOf : func(int, rlm .uverse.realm) .uverse.address Inspect
assertAdmin : func(int, rlm .uverse.realm) .uverse.address Inspect
design : type =skins.design
token : *v0.Token Inspect
ledger : *v0.PrivateLedger Inspect
designs : v0.BPTree Inspect
tokenSkin : v0.BPTree Inspect
owned : v0.BPTree Inspect
nextID : int64 =4
webPath : string ="/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/nfts/skins"
tokenName : untyped string ="gnofly skins"
tokenSymbol : untyped string ="SKIN"
payDenom : untyped string ="ugnot"
maxPrice : int64 =1000000000000
uriBase : untyped string ="https://gnofly.xyz/nft/skins/"
classic : untyped string ="classic"
init.61 : func() Inspect
bootstrap : func(int, rlm .uverse.realm) Inspect
getDesign : func(id string) *skins.design Inspect
putDesign : func(id string, name string, model string, pilot string, body string, wing string, accent string, price int64, maxSupply int64) Inspect
SetSkin : func(id string, name string, model string, pilot string, body string, wing string, accent string, price int64, maxSupply int64) Inspect
SetSkinListed : func(id string, listed bool) Inspect
webPathOf : func(pkgPath string) string Inspect
itoa : func(n int64) string Inspect
boolString : func(b bool) string Inspect
maxIDLen : untyped bigint =(32 <untyped> bigint)
maxModelLen : untyped bigint =(16 <untyped> bigint)
maxNameLen : untyped bigint =(40 <untyped> bigint)
validID : func(s string) bool Inspect
validModel : func(s string) bool Inspect
validName : func(s string) bool Inspect
validColor : func(s string) bool Inspect
validAddress : func(addr .uverse.address) bool Inspect
isSlug : func(s string, max int) bool Inspect