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 drops creates Launchpad NFT collections and runs their primary mints. It charges the collection fee and each ...

Overview

Package drops creates Launchpad NFT collections and runs their primary mints. It charges the collection fee and each mint price, and pays the treasury and the creator inside the same transaction: it holds no funds between calls and has no admin.

Constants 1

const KindFixed, KindAllowlist, KindHolder, KindDutch, maxPrimaryFeeBPS, maxStages, maxStageSeconds, maxPerWallet

 1const (
 2	KindFixed     = "fixed"     // one price, open to every wallet
 3	KindAllowlist = "allowlist" // only addresses under a Merkle root, each with its own allowance
 4	KindHolder    = "holder"    // one mint per token held in another collection
 5	KindDutch     = "dutch"     // the price falls in a straight line until the stage ends
 6
 7	// Hard limits, fixed for the life of this realm.
 8	maxPrimaryFeeBPS = 500 // 5% of a mint price
 9	maxStages        = 10
10	maxStageSeconds  = 365 * 24 * 60 * 60
11	maxPerWallet     = 1_000_000
12)
source

Functions 11

func AddStage

crossing Action
1func AddStage(cur realm, id, kind string, start, end, price, floor, supplyCap,
2	perWallet int64, root, gate, currencyKey string, maxFeeBPS int64) int
source

AddStage schedules a mint window and returns its index. The arguments are the terms of the stage, then the highest protocol fee the creator accepts. A collection has ten stages for its whole life: a stage that ended keeps its slot.

func AllowlistLeaf

Action
1func AllowlistLeaf(id string, index int, who address, allowance int64) merkle.Hash
source

AllowlistLeaf is the Merkle leaf that lets who mint up to allowance tokens in one stage: sha256(0x00 || "launchpad-drop-v1|<collection>|<stage>|<address>|<allowance>"). Only the chain's spelling of an address makes a leaf: a list written in capitals would name accounts that can never claim.

func CreateCollection

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

CreateCollection registers the caller's collection in the NFT ledger and pays the collection fee to the treasury. maxFee is the highest fee the caller accepts: a fee above it aborts before anything is taken, whatever the caller's allowance. Native coins are attached for exactly the fee; a token is pulled for exactly the fee. The collection terms are documented on nft.Create.

func EditStage

crossing Action
1func EditStage(cur realm, id string, index int, kind string, start, end, price,
2	floor, supplyCap, perWallet int64, root, gate, currencyKey string,
3	maxFeeBPS int64)
source

EditStage replaces a stage that has not started. Once a stage has opened its terms are final, whatever the replacement would have been: it can only be ended.

func EndStage

crossing Action
1func EndStage(cur realm, id string, index int)
source

EndStage closes an open stage at once and for good. It asks no lane: a creator stops its own sale whatever is paused.

func GateUsed

Action
1func GateUsed(id string, index int, gateNumber int64) bool
source

GateUsed reports whether a gate token has already paid for a mint in a holder stage.

func Mint

crossing Action
1func Mint(cur realm, id string, index int, currencyKey string, offered,
2	allowance int64, proof string, gateNumber int64) int64
source

Mint sells the caller one token of an open stage and returns its number. currencyKey and offered are what the caller accepts to pay: the stage must be priced in that currency, and offered is the most it will take. Native coins are attached for exactly offered and the difference with the price comes back, which is what makes a falling price payable; a token is pulled for exactly the price. The price is split between the treasury (the fee pinned on the stage) and the creator. allowance and proof are for an allowlist stage, gateNumber for a holder stage; elsewhere they are zero and empty.

func MintedBy

Action
1func MintedBy(id string, index int, who string) int64
source

MintedBy is how many tokens who has minted in a stage. Only the chain's spelling of an address is an account: any other is refused, never read as 0.

func StagesJSON

Action
1func StagesJSON(id string) string
source

StagesJSON lists a collection's stages in index order. "currentPrice" is the price a mint would pay now, and is only meaningful while "open" is true.

func TermsJSON

Action
1func TermsJSON(currencyKey string) string
source

TermsJSON is what creating a collection and scheduling a stage cost now: the collection fee in a currency and the protocol fee a new stage would pin. A value of -1 means the lane is closed; config's ActionStatusJSON tells whether a lane accepts new actions right now.

Imports 13

Source Files 4