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 source realm

Package nft is the Launchpad collection ledger. Each collection is a GRC721 token whose transfer mode, royalties and ...

Overview

Package nft is the Launchpad collection ledger. Each collection is a GRC721 token whose transfer mode, royalties and metadata rules are fixed at creation. Collections are created, and their tokens minted, only by issuer realms: the Launchpad drops realm and any realm the config admin adds. Holders move, approve and burn their own tokens. The ledger has no admin of its own: nothing here can move a holder's token or change a collection's terms, and a paused lane stops only new collections and new mints.

Constants 2

Functions 38

func AcceptCreator

crossing Action
1func AcceptCreator(cur realm, id string)
source

AcceptCreator makes the caller the creator it was proposed as.

func AllowMarket

crossing Action
1func AllowMarket(cur realm, id, pkgPath string)
source

AllowMarket adds a realm through which a royalty-protected collection's tokens may be sold. The list starts with the Launchpad market and only grows: a holder's way out can be widened, never taken away. The ledger cannot make a realm pay: the creator vouches that the market it lists pays this collection's royalties, and every holder can read the list.

func ApprovalJSON

Action
1func ApprovalJSON(id string, number int64, operator string) string
source

ApprovalJSON answers, in one read, whether operator may move an active token: by a single-token approval or by the owner's collection-wide one.

func Approve

crossing Action
1func Approve(cur realm, id string, to address, number int64)
source

Approve lets one account move one token; an empty address clears it. A soulbound token takes no approval at all, a royalty-protected one only a listed market.

func Burn

crossing Action
1func Burn(cur realm, id string, number int64)
source

Burn is the holder's alone, in every mode. No creator, operator or admin can destroy a token somebody else holds, except through Revoke.

func CapabilitiesJSON

Action
1func CapabilitiesJSON(id string) string
source

CapabilitiesJSON tells a wallet or a market what a holder of this collection can do, without it knowing the modes. "markets" is empty when any operator may be approved. Royalties are paid by markets at sale. "royaltyEnforcement" is "none" without royalties; "market_sales" for an open collection, where the ledger enforces nothing: a market that honours royalties pays them at a sale, and a direct transfer or any other realm pays none; "listed_markets" when the ledger lets a token move only through the realms in "markets". Whether a listed realm pays is the word of the creator who listed it. "creatorRevoke" is the creator's right to revoke a token of a revocable soulbound collection.

func CommitTraits

crossing Action
1func CommitTraits(cur realm, id, root string)
source

CommitTraits records, once, the Merkle root of the collection's traits. It waits for frozen metadata so the root cannot outlive the files it describes. A leaf is sha256(0x00 || "launchpad-trait-v1|<collection>|<number>|<type>=<value>") in a p/samcrew/launchpad/merkle/v1 tree, where neither the type nor the value contains "=" or "|": a leaf has then one reading only, and a leaf that breaks the rule matches no trait offer. The ledger cannot check the root against the files; whoever relies on it must recompute it from them.

func Create

crossing Action
1func Create(cur realm, creator address, name, symbol, description, image,
2	banner, website, mode string, revocable bool, maxSupply int64,
3	metadataMode, baseURI, placeholderURI, commitment, provenance,
4	royalties string) string
source

Create registers a collection for a creator the calling issuer realm has authenticated and charged. The issuer is recorded on the collection and no other realm can mint into it. royalties is "address:bps;address:bps" with addresses in strictly ascending order, or empty; the metadata arguments are those of newMetadata.

func Epoch

Action
1func Epoch(id string, number int64) int64
source

Epoch returns the ID of a token's current custody: a new one at every move and every change of its single-token approval (the same approval again changes nothing), never one given before; 0 for a retired token. A market binds an order to it, so the order dies with the custody it was made under.

func FreezeMetadata

crossing Action
1func FreezeMetadata(cur realm, id string)
source

FreezeMetadata gives up the right to change a mutable collection's base URI.

func HoldingsJSON

Action
1func HoldingsJSON(owner string, page, size int64) string
source

HoldingsJSON pages through the tokens an account holds, across every collection, in collection then number order.

func ListCollectionsJSON

Action
1func ListCollectionsJSON(page, size int64) string
source

ListCollectionsJSON pages through a summary of every collection, in creation order. CollectionJSON has the full record.

func MintTo

crossing Action
1func MintTo(cur realm, id string, recipient address) int64
source

MintTo issues the next token number. Only the collection's issuer calls it, after its own accounting of stages and payment. The ledger mints to whoever the issuer names: it is the issuer's duty to mint a soulbound token only to the wallet that asked for it.

func ProposeCreator

crossing Action
1func ProposeCreator(cur realm, id string, next address)
source

ProposeCreator starts handing the creator role to another account. Nothing changes until that account accepts; an empty address withdraws the offer.

func Reveal

crossing Action
1func Reveal(cur realm, id, baseURI, salt string)
source

Reveal publishes the base URI committed at creation, with the salt that opens the commitment, and fixes it for good. The commitment stays bound to the account that created the collection, whoever holds the creator role now.

func RevealCommitment

Action
1func RevealCommitment(creator address, salt, baseURI string) string
source

RevealCommitment is what a creator commits to at creation and opens at Reveal: sha256("launchpad-reveal-v1|<creator>|<salt>|<base URI>"), with a salt of 64 hex digits the creator keeps secret until then. The salt keeps a guessed URI from being confirmed before the reveal. The creator's address keeps another account from reusing the commitment: a collection's ID does not exist yet when its creator commits, so the account stands in for it.

func Revoke

crossing Action
1func Revoke(cur realm, id string, number int64, reason string)
source

Revoke retires a credential. It exists only for soulbound collections created as revocable, a term every holder could read before claiming. A holder who burns first leaves a burned token, not a revoked one.

func SealSupply

crossing Action
1func SealSupply(cur realm, id string)
source

SealSupply ends minting for good, whatever the cap was.

func SetApprovalForAll

crossing Action
1func SetApprovalForAll(cur realm, id string, to address, approved bool)
source

SetApprovalForAll lets, or stops letting, one account move every token the caller holds in the collection.

func SetBaseURI

crossing Action
1func SetBaseURI(cur realm, id, baseURI string)
source

SetBaseURI points a mutable collection at new metadata. Every change is announced with its revision number.

func SetIssuer

crossing Action
1func SetIssuer(cur realm, id, pkgPath string)
source

SetIssuer moves the collection's minting to another issuer realm, for instance a later version of the one that created it. Only the creator can choose it, and only among realms allowed to issue.

func TokenJSON

Action
1func TokenJSON(id string, number int64) string
source

TokenJSON describes one minted number. A retired token has no owner.

func TokenURI

Action
1func TokenURI(id string, number int64) string
source

TokenURI answers for every minted number, retired or not: the metadata of a burned token is still part of the collection's public record.

func TokensJSON

Action
1func TokensJSON(id string, page, size int64) string
source

TokensJSON pages through a collection's minted numbers in order, retired ones included.

func TransferFrom

crossing Action
1func TransferFrom(cur realm, id string, from, to address, number int64)
source

TransferFrom moves a token when the collection's mode lets the caller move one, and the caller owns it or is approved for it.

func RoyaltyQuote

Action
1func RoyaltyQuote(id string, price int64) []RoyaltyPayout
source

RoyaltyQuote floors each receiver's share of price. The seller keeps the rounding remainder.

Types 2

type Info

struct
 1type Info struct {
 2	ID             string // "C<n>"
 3	GRC721ID       string
 4	Issuer         address // the only realm that mints into the collection
 5	Creator        address
 6	Originator     address // the creator at creation, whoever holds the role now
 7	PendingCreator address
 8	Name           string
 9	Symbol         string
10	Description    string
11	Image          string
12	Banner         string
13	Website        string
14	Mode           string
15	Revocable      bool  // soulbound only: the creator may revoke a token
16	MaxSupply      int64 // zero means an uncapped open edition
17	Sealed         bool  // no token can ever be minted again
18	Minted         int64 // includes retired tokens; numbers are never reused
19	ProfileFrozen  bool
20}
source

Info is a collection's public record. The creator may edit the profile fields until FreezeProfile, hand the creator role over and seal the supply; everything else is immutable.

Imports 12

Source Files 5