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

v1 state

Back to all declarations

marketPath

untyped string

Value

"gno.land/r/samcrew/launchpad/market/v1"

StatusFilled

untyped string

Value

"filled"

StatusCancelled

untyped string

Value

"cancelled"

StatusReplaced

untyped string

Value

"replaced"

StatusExpired

untyped string

Value

"expired"

maxSecondaryFeeBPS

untyped bigint

// 2% of a sale price

Value

(200 <untyped> bigint)

maxLifetime

untyped bigint

Value

(7776000 <untyped> bigint)

graceToClose

untyped bigint

Value

(604800 <untyped> bigint)

maxOrders

untyped bigint

Value

(9999999999 <untyped> bigint)

Listing

type

Listing offers one token at a fixed price. The seller keeps the token and approves this realm; nothing is held here. A listing exists while it is open and no longer, and can be bought only within the token's custody epoch it was made in.

Value

v1.Listing

lastListing

v0.ID

Value

<zero>

listings

v0.Tree

// listing key -> \*Listing, in creation order

Open
OID
0af88e…5f22:5
listings details

Inspect ref

listed

v0.Tree

// "\<collection>/\<token number key>" -> \*Listing

Open
OID
0af88e…5f22:7
listed details

Inspect ref

bySeller

v0.Tree

// "\<seller>/\<listing key>" -> \*Listing

Open
OID
0af88e…5f22:9
bySeller details

Inspect ref

directCaller

func() .uverse.address
Open
OID
0af88e…5f22:10
directCaller details

Inspect func

orderKey

func(prefix uint8, id string) (string, bool)

orderKey reads an order ID, its prefix ('L' listing, 'O' offer) then its number, as its tree key.

Open
OID
0af88e…5f22:12
orderKey details

Inspect func

nextOrder

func(last *v0.ID, prefix string) (string, string)
Open
OID
0af88e…5f22:13
nextOrder details

Inspect func

findListing

func(id string) *v1.Listing

findListing returns an open listing, or nil: a closed one is gone.

Open
OID
0af88e…5f22:14
findListing details

Inspect func

mustListing

func(id string) *v1.Listing
Open
OID
0af88e…5f22:15
mustListing details

Inspect func

tokenKey

func(collection string, number int64) string

tokenKey sorts a collection's tokens in number order.

Open
OID
0af88e…5f22:16
tokenKey details

Inspect func

listingOf

func(collection string, number int64) *v1.Listing

listingOf returns the open listing of a token, or nil.

Open
OID
0af88e…5f22:17
listingOf details

Inspect func

sellable

func(collection string, number int64, seller .uverse.address) bool

sellable reports whether seller owns the active token and has approved this realm for that token. Only a single-token approval counts, as an approval for all would outlive the token's moves.

Open
OID
0af88e…5f22:18
sellable details

Inspect func

pinned

func(collection string, price int64, expiresAt int64, currencyKey string, maxFeeBPS int64) int64

pinned checks what every new order needs (a collection that can be sold, a price, a lifetime of at most 90 days) and returns the protocol fee to pin on it: the current one, which must not exceed what its owner accepts nor this realm's cap.

Open
OID
0af88e…5f22:19
pinned details

Inspect func

List

func(collection string, number int64, price int64, expiresAt int64, currencyKey string, maxFeeBPS int64) string

List offers the caller's token for sale and returns the listing ID. The caller must first approve this realm in the NFT ledger, and names the highest protocol fee it accepts; the fee in force is pinned on the listing. A new listing replaces the token's previous one.

Open
OID
0af88e…5f22:20
List details

Inspect func

closeListing

func(l *v1.Listing, status string)

closeListing deletes a listing and says why in its closing event.

Open
OID
0af88e…5f22:21
closeListing details

Inspect func

live

func(l *v1.Listing) bool

live reports whether a listing can be bought right now. A move or an approval change starts a new custody epoch, so a listing never comes back to life when a token that left the seller returns or the market is approved again: the seller lists anew.

Open
OID
0af88e…5f22:22
live details

Inspect func

Cancel

func(id string)

Cancel withdraws a listing. The seller can always do it, paused market or not. Anyone can clear a listing whose seller no longer owns the token, or one that expired more than graceToClose ago; the chain returns the storage deposit of what a call frees to its caller, so clearing pays whoever does it.

Open
OID
0af88e…5f22:23
Cancel details

Inspect func

Buy

func(id string, currencyKey string, price int64)

Buy pays a listing's exact price and moves the token to the caller. currencyKey and price are the terms the buyer read: a listing on other terms, such as an ID the buyer never saw, takes nothing.

Open
OID
0af88e…5f22:24
Buy details

Inspect func

GetListing

func(id string) v1.Listing

GetListing returns an open listing; a closed or unknown ID aborts.

Open
OID
0af88e…5f22:25
GetListing details

Inspect func

OfferToken

untyped string

// one named token

Value

"token"

OfferCollection

untyped string

// any token of the collection

Value

"collection"

OfferTrait

untyped string

// any token proven to carry a trait

Value

"trait"

StatusAccepted

untyped string

Value

"accepted"

StatusSuperseded

untyped string

Value

"superseded"

maxTraitBytes

untyped bigint

Value

(100 <untyped> bigint)

Offer

type

Offer is a bid whose full price sits in this realm until it is accepted, cancelled by its buyer or returned after expiry. An offer exists while it is open and no longer.

Value

v1.Offer

lastOffer

v0.ID

Value

<zero>

offers

v0.Tree

// offer key -> \*Offer, in creation order

Open
OID
0af88e…5f22:29
offers details

Inspect ref

open

v0.Tree

// "\<collection>/\<offer key>" -> \*Offer

Open
OID
0af88e…5f22:31
open details

Inspect ref

byBuyer

v0.Tree

// "\<buyer>/\<offer key>" -> \*Offer

Open
OID
0af88e…5f22:33
byBuyer details

Inspect ref

findOffer

func(id string) (*v1.Offer, string)

findOffer returns an open offer and its key, or nil: a closed one is gone.

Open
OID
0af88e…5f22:34
findOffer details

Inspect func

mustOffer

func(id string) (*v1.Offer, string)
Open
OID
0af88e…5f22:36
mustOffer details

Inspect func

TraitLeaf

func(collection string, number int64, trait string) [32]uint8

TraitLeaf is the Merkle leaf that proves a token carries a trait, as committed by the collection's creator in the NFT ledger.

Open
OID
0af88e…5f22:37
TraitLeaf details

Inspect func

MakeOffer

func(kind string, collection string, number int64, trait string, price int64, expiresAt int64, currencyKey string, maxFeeBPS int64) string

MakeOffer escrows price and returns the offer ID. kind selects what the offer is for: number is set for a token offer, trait for a trait offer, and both are zero and empty otherwise. A trait offer needs a collection whose creator committed its traits. The protocol fee in force is pinned on the offer; it comes out of what the seller receives, never on top of the price, and maxFeeBPS is the highest the buyer lets a seller be charged.

Open
OID
0af88e…5f22:38
MakeOffer details

Inspect func

release

func(o *v1.Offer, key string, status string)

release deletes an offer, takes its price out of escrow and says why in its closing event; the caller then pays the price out. Every exit goes through here, and an offer leaves escrow once, by its own key: with \`settled\`, an exit pays out exactly the price of the one offer it closed, so a fault in one offer's exit can never spend another offer's escrow.

Open
OID
0af88e…5f22:39
release details

Inspect func

refund

func(o *v1.Offer, key string, status string)

refund returns an open offer's escrow to its buyer. Refunds never consult the config realm: no pause or policy change can hold a buyer's funds.

Open
OID
0af88e…5f22:40
refund details

Inspect func

CancelOffer

func(id string)

CancelOffer takes back the caller's own open offer, expired or not.

Open
OID
0af88e…5f22:41
CancelOffer details

Inspect func

ExpireOffer

func(id string)

ExpireOffer returns to its buyer the escrow of an offer that expired more than graceToClose ago. Anyone may call it: the price goes to the buyer, and the chain pays the caller the storage deposit of the bytes the offer occupied, so for a week after expiry only the buyer, with CancelOffer, takes its own offer back.

Open
OID
0af88e…5f22:42
ExpireOffer details

Inspect func

AcceptOffer

func(id string, number int64, proof string, currencyKey string, price int64)

AcceptOffer sells the caller's token number to an open offer. proof is the comma-separated Merkle path of the token's trait for a trait offer, and empty otherwise. currencyKey and price are the terms the seller read: an offer on other terms, such as an ID the seller never saw, buys nothing. The caller must first approve this realm in the NFT ledger.

Open
OID
0af88e…5f22:43
AcceptOffer details

Inspect func

GetOffer

func(id string) v1.Offer

GetOffer returns an open offer; a closed or unknown ID aborts.

Open
OID
0af88e…5f22:44
GetOffer details

Inspect func

EscrowOf

func(currencyKey string) int64

EscrowOf is the total of open offers in a currency.

Open
OID
0af88e…5f22:45
EscrowOf details

Inspect func

escrow

map[string]int64

escrow is, per currency, the total of open offers: everything this realm owes. Currencies are few (config allows sixteen), so a map is enough.

Open
OID
0af88e…5f22:47
escrow details

Inspect map

terms

type

terms is what this realm needs from config.

Value

v1.terms

policy

func(currencyKey string) v1.terms

policy returns the current terms after checking that the market lane is open for the currency. It is a variable only so that unit tests can stand in for the config realm, whose admin cannot be set from another package's tests.

Open
OID
0af88e…5f22:49
policy details

Inspect func

surplus

func(key string) int64

surplus is what the realm holds beyond its open offers. Every entry point must leave it exactly as it found it.

Open
OID
0af88e…5f22:52
surplus details

Inspect func

take

func(key string, amount int64) int64

take collects exactly amount from the direct caller, attached for native coins and pulled for a token, and returns the surplus before the payment.

Open
OID
0af88e…5f22:53
take details

Inspect func

untouched

func(key string) int64

untouched is take for an entry point that receives nothing.

Open
OID
0af88e…5f22:54
untouched details

Inspect func

pay

func(key string, to .uverse.address, amount int64)
Open
OID
0af88e…5f22:55
pay details

Inspect func

settle

func(key string, collection string, price int64, feeBPS int64, seller .uverse.address, treasury .uverse.address)

settle splits a sale price: the protocol fee to the treasury, each royalty to its receiver, the rest, rounding included, to the seller.

Open
OID
0af88e…5f22:56
settle details

Inspect func

settled

func(key string, before int64)

settled aborts the transaction unless the realm holds exactly its open offers plus the surplus it had before the call: nothing taken is left behind, and nothing owed has been spent.

Open
OID
0af88e…5f22:57
settled details

Inspect func

splitJSON

func(collection string, price int64, feeBPS int64) string

splitJSON is how a price would be divided at a protocol fee: what the seller keeps, the treasury's fee and each royalty.

Open
OID
0af88e…5f22:60
splitJSON details

Inspect func

listingJSON

func(l *v1.Listing) string
Open
OID
0af88e…5f22:61
listingJSON details

Inspect func

offerJSON

func(o *v1.Offer) string
Open
OID
0af88e…5f22:62
offerJSON details

Inspect func

ListingJSON

func(id string) string

ListingJSON is an open listing, or "null" once it is closed.

Open
OID
0af88e…5f22:63
ListingJSON details

Inspect func

OfferJSON

func(id string) string

OfferJSON is an open offer, or "null" once it is closed. An open offer can be past its expiry: it then only waits for its refund.

Open
OID
0af88e…5f22:64
OfferJSON details

Inspect func

maxSlice

untyped bigint

Lists are read in slices of 1 to maxSlice entries that start after a cursor: what identifies the last entry already read, or nothing to start from the beginning. Orders come and go between two reads, and a cursor never skips or repeats one that stayed. A slice costs the same wherever it starts.

Value

(50 <untyped> bigint)

sliceJSON

func(tree *v0.Tree, from string, to string, reverse bool, size int64, render func(...)) string

sliceJSON renders up to size entries of tree whose keys lie in \[from, to), in key order, or from the last key down when reverse.

Open
OID
0af88e…5f22:65
sliceJSON details

Inspect func

cursorKey

func(prefix uint8, cursor string) v0.ID

cursorKey reads an order cursor: the ID of the last order already read.

Open
OID
0af88e…5f22:66
cursorKey details

Inspect func

after

func(prefix uint8, cursor string) string

after is the first key an oldest-first slice may hold: the one following the cursor, or "" with no cursor.

Open
OID
0af88e…5f22:67
after details

Inspect func

below

func(prefix uint8, cursor string) string

below is the last key a newest-first slice may hold: the one preceding the cursor, or "" with no cursor. No order has key zero, so the first order's ID leaves nothing below it.

Open
OID
0af88e…5f22:68
below details

Inspect func

renderListing

func(v interface{...}) string
Open
OID
0af88e…5f22:69
renderListing details

Inspect func

renderOffer

func(v interface{...}) string
Open
OID
0af88e…5f22:70
renderOffer details

Inspect func

ListingsJSON

func(before string, size int64) string

ListingsJSON reads every open listing, newest first, starting below the listing ID before ("" starts from the newest).

Open
OID
0af88e…5f22:71
ListingsJSON details

Inspect func

CollectionListingsJSON

func(collection string, afterNumber int64, size int64) string

CollectionListingsJSON reads a collection's open listings in token number order, starting after the token number afterNumber (0 starts from the first).

Open
OID
0af88e…5f22:72
CollectionListingsJSON details

Inspect func

account

func(who string) string

account checks an address argument of a view.

Open
OID
0af88e…5f22:73
account details

Inspect func

SellerListingsJSON

func(seller string, afterID string, size int64) string

SellerListingsJSON reads an account's open listings, oldest first, starting after the listing ID afterID ("" starts from the oldest).

Open
OID
0af88e…5f22:74
SellerListingsJSON details

Inspect func

OffersJSON

func(before string, size int64) string

OffersJSON reads every open offer, newest first, starting below the offer ID before ("" starts from the newest).

Open
OID
0af88e…5f22:75
OffersJSON details

Inspect func

CollectionOffersJSON

func(collection string, afterID string, size int64) string

CollectionOffersJSON reads a collection's open offers of every kind, oldest first, starting after the offer ID afterID ("" starts from the oldest).

Open
OID
0af88e…5f22:76
CollectionOffersJSON details

Inspect func

BuyerOffersJSON

func(buyer string, afterID string, size int64) string

BuyerOffersJSON reads an account's open offers, oldest first, starting after the offer ID afterID ("" starts from the oldest).

Open
OID
0af88e…5f22:77
BuyerOffersJSON details

Inspect func

TokenListingJSON

func(collection string, number int64) string

TokenListingJSON is the open listing of a token, or "null".

Open
OID
0af88e…5f22:78
TokenListingJSON details

Inspect func

TermsJSON

func(collection string, price int64) string

TermsJSON is what a sale costs now: the protocol fee a new listing would pin, and how a price would split for the collection. A fee of -1 means the lane is closed; config's ActionStatusJSON tells whether the market lane accepts new orders right now.

Open
OID
0af88e…5f22:79
TermsJSON details

Inspect func
marketPath : untyped string ="gno.land/r/samcrew/launchpad/market/v1"
StatusFilled : untyped string ="filled"
StatusCancelled : untyped string ="cancelled"
StatusReplaced : untyped string ="replaced"
StatusExpired : untyped string ="expired"
maxSecondaryFeeBPS : untyped bigint =(200 <untyped> bigint)
maxLifetime : untyped bigint =(7776000 <untyped> bigint)
graceToClose : untyped bigint =(604800 <untyped> bigint)
maxOrders : untyped bigint =(9999999999 <untyped> bigint)
Listing : type =v1.Listing
lastListing : v0.ID =<zero>
listings : v0.Tree Inspect
listed : v0.Tree Inspect
bySeller : v0.Tree Inspect
directCaller : func() .uverse.address Inspect
orderKey : func(prefix uint8, id string) (string, bool) Inspect
nextOrder : func(last *v0.ID, prefix string) (string, string) Inspect
findListing : func(id string) *v1.Listing Inspect
mustListing : func(id string) *v1.Listing Inspect
tokenKey : func(collection string, number int64) string Inspect
listingOf : func(collection string, number int64) *v1.Listing Inspect
sellable : func(collection string, number int64, seller .uverse.address) bool Inspect
pinned : func(collection string, price int64, expiresAt int64, currencyKey string, maxFeeBPS int64) int64 Inspect
List : func(collection string, number int64, price int64, expiresAt int64, currencyKey string, maxFeeBPS int64) string Inspect
closeListing : func(l *v1.Listing, status string) Inspect
live : func(l *v1.Listing) bool Inspect
Cancel : func(id string) Inspect
Buy : func(id string, currencyKey string, price int64) Inspect
GetListing : func(id string) v1.Listing Inspect
Render : func(path string) string Inspect
OfferToken : untyped string ="token"
OfferCollection : untyped string ="collection"
OfferTrait : untyped string ="trait"
StatusAccepted : untyped string ="accepted"
StatusSuperseded : untyped string ="superseded"
maxTraitBytes : untyped bigint =(100 <untyped> bigint)
Offer : type =v1.Offer
lastOffer : v0.ID =<zero>
offers : v0.Tree Inspect
open : v0.Tree Inspect
byBuyer : v0.Tree Inspect
findOffer : func(id string) (*v1.Offer, string) Inspect
mustOffer : func(id string) (*v1.Offer, string) Inspect
TraitLeaf : func(collection string, number int64, trait string) [32]uint8 Inspect
MakeOffer : func(kind string, collection string, number int64, trait string, price int64, expiresAt int64, currencyKey string, maxFeeBPS int64) string Inspect
release : func(o *v1.Offer, key string, status string) Inspect
refund : func(o *v1.Offer, key string, status string) Inspect
CancelOffer : func(id string) Inspect
ExpireOffer : func(id string) Inspect
AcceptOffer : func(id string, number int64, proof string, currencyKey string, price int64) Inspect
GetOffer : func(id string) v1.Offer Inspect
EscrowOf : func(currencyKey string) int64 Inspect
escrow : map[string]int64 Inspect
terms : type =v1.terms
policy : func(currencyKey string) v1.terms Inspect
balance : func(key string) int64 Inspect
surplus : func(key string) int64 Inspect
take : func(key string, amount int64) int64 Inspect
untouched : func(key string) int64 Inspect
pay : func(key string, to .uverse.address, amount int64) Inspect
settle : func(key string, collection string, price int64, feeBPS int64, seller .uverse.address, treasury .uverse.address) Inspect
settled : func(key string, before int64) Inspect
num : func(n int64) string Inspect
splitJSON : func(collection string, price int64, feeBPS int64) string Inspect
listingJSON : func(l *v1.Listing) string Inspect
offerJSON : func(o *v1.Offer) string Inspect
ListingJSON : func(id string) string Inspect
OfferJSON : func(id string) string Inspect
maxSlice : untyped bigint =(50 <untyped> bigint)
sliceJSON : func(tree *v0.Tree, from string, to string, reverse bool, size int64, render func(...)) string Inspect
cursorKey : func(prefix uint8, cursor string) v0.ID Inspect
after : func(prefix uint8, cursor string) string Inspect
below : func(prefix uint8, cursor string) string Inspect
renderListing : func(v interface{...}) string Inspect
renderOffer : func(v interface{...}) string Inspect
ListingsJSON : func(before string, size int64) string Inspect
CollectionListingsJSON : func(collection string, afterNumber int64, size int64) string Inspect
account : func(who string) string Inspect
SellerListingsJSON : func(seller string, afterID string, size int64) string Inspect
OffersJSON : func(before string, size int64) string Inspect
CollectionOffersJSON : func(collection string, afterID string, size int64) string Inspect
BuyerOffersJSON : func(buyer string, afterID string, size int64) string Inspect
TokenListingJSON : func(collection string, number int64) string Inspect
TermsJSON : func(collection string, price int64) string Inspect