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 market of gnofly's planes: a fixed-price book where a plane's owner lists it, anyone buys it, a...

Overview

Package gnofly is the market of gnofly's planes: a fixed-price book where a plane's owner lists it, anyone buys it, and each sale pays the planes realm's royalty (RoyaltyInfo: 5% to the gnofly treasury) out of the price.

It is a wrapper, not a collection: 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 for one plane, or SetApprovalForAll); List then moves the plane here, in escrow, Buy hands it to the buyer and Cancel back to the seller.

Its calls and reads have the shapes Bazaar's site (bazaar.gnomi.fun) uses on a collection package (List, UpdatePrice, Cancel, Buy, Transfer; ListOpen, ItemLine, TokensOf, Minted), so that it can be registered there later, under the slug of its last path element. It is not registered, and pays Bazaar nothing.

It is version v0 of the market (the path's v0). SetPaused stops new listings for a move to a newer one; 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 16

func Buy

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

Buy buys a listed plane: send exactly its price in ugnot. The royalty of the planes realm (RoyaltyInfo: 5% to the gnofly treasury) is paid out of the price, the seller receives the rest, and 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 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 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 10

Source Files 6