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

gnofly source realm

Package gnofly is the wrapper that puts gnofly's planes on Bazaar (bazaar.gnomi.fun), the NFT marketplace of gno.land.

Overview

Package gnofly is the wrapper that puts gnofly's planes on Bazaar (bazaar.gnomi.fun), the NFT marketplace of gno.land.

Bazaar lists the collections registered on its factory, bazaarv5, and sends its site's List, Buy and Cancel to the collection's own package. This realm is that package for the planes: Init registers it under the slug "gnofly" (its last path element), and it holds the book. It mints nothing: the planes are the tokens of gno.land/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/nfts/planes, moved with that realm's TransferFrom. A seller first approves this realm there (Approve, or SetApprovalForAll once); List then moves the plane here, in escrow, Buy hands it to the buyer and Cancel back to the seller.

A sale pays, out of its price: Bazaar's fee (read from the factory: its ProtocolBps less the holder discount, split between its sinks), the planes realm's royalty (5% to the gnofly treasury), and the rest to the seller.

It is version v1 of the market; v0 is the same book without Bazaar, which cannot register. SetPaused stops new listings for a move to a newer version; Cancel and Buy keep working, so no plane is ever stuck here.

Every write is a direct call from a wallet: no realm can list, buy or cancel in a user's name.

Functions 18

func Buy

crossing Action
1func Buy(cur realm, id int)
source

Buy buys a listed plane: send exactly its price in ugnot. Out of the price: Bazaar's fee (bazaarFee, to its sinks), the planes realm's royalty (RoyaltyInfo: 5% to the gnofly treasury), and the rest to the seller; the plane goes to the buyer. It works while the market is paused.

func Cancel

crossing Action
1func Cancel(cur realm, id int)
source

Cancel takes a listing down and gives the plane back to its seller. It works while the market is paused.

func Init

crossing Action
1func Init(cur realm)
source

Init registers this realm on Bazaar's factory. The factory requires the slug "gnofly" reserved first, with Reserve, by the wallet calling Init; it must be an admin of the game realm here too: the gnofly wallet. Once only.

func ItemLine

Action
1func ItemLine(id int) string
source

ItemLine returns the line of plane id, listed or not. It panics for an id that is not a minted plane: Bazaar's site skips the ids it cannot read.

func List

crossing Action
1func List(cur realm, id int, priceUgnot int64)
source

List puts plane id up for sale at priceUgnot. The caller must own it and have approved this realm on the planes realm (Approve for this plane, or SetApprovalForAll): the plane moves here, in escrow, until it is bought or the listing is cancelled.

func ListOpen

Action
1func ListOpen() string
source

ListOpen returns the listings, one line each, in id order, at most 50.

func Name

Action
1func Name() string
source

Name and Symbol are the planes collection's: the market sells nothing else.

func Registered

Action
1func Registered() bool
source

Registered reports whether Init has registered this realm on Bazaar.

func Render

1func Render(_ string) string
source

Render shows the listings on gnoweb.

func ReturnStray

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

ReturnStray gives back a plane this realm holds outside any listing: one someone sent here by mistake. Admin of the game realm only; to is who it came from, as the chain's transfer events show.

func SetPaused

crossing Action
1func SetPaused(cur realm, p bool)
source

SetPaused stops (or resumes) new listings and price changes. Admin of the game realm only. Cancel and Buy keep working, so a move to a newer market never strands a plane: sellers cancel here and list there.

func TokenURI

Action
1func TokenURI(tid string) string
source

TokenURI returns the image of a plane, an https URL.

func TokensOf

Action
1func TokensOf(owner string) string
source

TokensOf returns the ids of the planes owner holds, comma-separated, in id order: "3,42,700". A listed plane is not among them: it is held here.

func Transfer

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

Transfer gives a plane the caller owns, not listed, to another address, through this realm: the call Bazaar's site makes. It needs the same approval as List. A plane can always be moved on the planes realm itself.

func UpdatePrice

crossing Action
1func UpdatePrice(cur realm, id int, priceUgnot int64)
source

UpdatePrice changes the price of a plane the caller listed.

Imports 11

Source Files 7