v1 source realm
Package sales owns launch token custody, direct-creation allocations, fair sales and airdrops. Quote that reaches it ...
Package sales owns launch token custody, direct-creation allocations, fair sales and airdrops. Quote that reaches it through its entry points is owed to someone on record: buyers (escrow and refunds), creators (settled proceeds) or the protocol (fees). Coins sent to it any other way are owed to no one and never leave. It has no admin and no emergency withdrawal path.
33
func AirdropClaimed
Actionfunc CancelFairSale
crossing ActionCancelFairSale returns the entire unsold allocation to its creator while there are no contributions. It remains callable if the new-sale lane is paused or the quote currency has since been delisted. The creation fee is not returned.
func CancelVestingBeneficiary
crossing Actionfunc ClaimAirdrop
crossing Action1func ClaimAirdrop(cur realm, id string, index int, beneficiary address, amount int64, proof string)ClaimAirdrop remains available while the airdrop lane is paused. Anyone can submit a proof; the destination is always the leaf's beneficiary. A leaf whose beneficiary is not written as the chain writes a caller's address can never be claimed: the token ledger would credit a balance no caller can reach.
func ClaimFair
crossing ActionClaimFair lets anyone release a buyer's recorded tokens and quote refund to that buyer. Claims never expire and ignore current pause/listing.
func ClaimVested
crossing ActionClaimVested remains open even when the direct-launch lane is paused. Anyone may trigger release, but the destination is always the recorded beneficiary. This also permits a realm beneficiary to receive its vested tokens.
func ContributeFair
crossing ActionContributeFair escrows exact quote atoms for whole token lots at this transaction's schedule price. The direct caller is both payer and buyer, and maxDeposit is the most the order may cost. A native order attaches exactly maxDeposit and gets maxDeposit minus the cost back in the same transaction; a token order pulls only the cost from the buyer's allowance.
func ContributeFairWithProof
crossing ActionContributeFairWithProof verifies the recorded allowlist and holding gates against the direct buyer's live address and balances before collecting quote.
func CreateAirdrop
crossing ActionCreateAirdrop funds one immutable campaign for a token from its creator's allowance. Its Merkle leaves are sha256(0x00 || "launchpad-airdrop-v1|<token-id>|<index>|<beneficiary>|<amount>"). The token ID in every leaf prevents a proof from authorizing a claim on a different launch, even if two creators publish the same tree shape.
func CreateDirect
crossing ActionCreateDirect creates a direct token without an initial airdrop. The allocation string is parsed and the whole amount partitioned before any payment. The caller, payer and initial mint's creator are the same live direct user.
func CreateDirectWithAirdrop
crossing ActionCreateDirectWithAirdrop reserves part of the initial mint for one Merkle campaign. The caller commits to the next token ID used in every leaf. If another launch takes that ID first, this transaction rejects before payment.
func CreateFairSale
crossing Action1func CreateFairSale(cur realm, name, ticker string, decimals int,
2 initialSupply, saleAllocation, lotSize, hardLots, walletCapLots, softQuote int64,
3 quoteCurrency string, expectedVersion int64,
4 start, end, startPrice, floorPrice, decrement, intervalSeconds int64,
5 description, image, website, xHandle, telegram string) stringCreateFairSale mints a fixed-supply fair-sale token and encumbers its whole- lot allocation in sales custody. The creator receives the initial supply remainder.
func CreateFairSaleFromToken
crossing ActionCreateFairSaleFromToken locks an existing direct token's exact creator-funded allocation. Other token liabilities remain encumbered in the same custody balance. One token can have at most one fair sale.
func CreateGatedFairSale
crossing Action1func CreateGatedFairSale(cur realm, name, ticker string, decimals int,
2 initialSupply, saleAllocation, lotSize, hardLots, walletCapLots, softQuote int64,
3 quoteCurrency string, expectedVersion int64,
4 start, end, startPrice, floorPrice, decrement, intervalSeconds int64,
5 description, image, website, xHandle, telegram,
6 expectedID, allowlistRoot, holdingGates string) stringCreateGatedFairSale binds a precomputed token ID to a Merkle root and/or token-holding gates. The expected ID prevents an intervening creation from silently attaching the root to a different token.
func CreateGatedFairSaleFromToken
crossing Actionfunc FairBuyerJSON
ActionFairBuyerJSON is one buyer's record in a sale and, once the sale is settled and until the buyer is paid, what ClaimFair would send them. Before settlement both amounts are 0 and settled is false: settle first.
func LaunchJSON
ActionLaunchJSON is a token's launch state: the ledger's record of the token, what sales still owes in it, how many vesting records it has, and its fair sale and airdrop campaign, each null when the token has none.
func MintCappedAllocated
crossing ActionMintCappedAllocated requires the token's current mint authority to be the immediate user or realm caller. Every new unit is assigned to an immediate or vested allocation; there is no implicit receiver or unrecorded sales balance. No additional creation fee is charged, and attached native coins are rejected. Pausing the direct lane stops new mints without blocking claims.
func ProposeVestingBeneficiary
crossing ActionProposeVestingBeneficiary is callable by the current beneficiary, including a beneficiary realm. A pending move freezes claims until acceptance or cancellation, so the old beneficiary cannot drain accrued entitlement.
func ReleaseFairProceeds
crossing ActionReleaseFairProceeds pays a succeeded sale's creator what settlement recorded for them, once, and returns the amount. Anyone can call it; the receiver is always the recorded creator. It stays open while the lane is paused or the currency delisted.
func RevokeVesting
crossing ActionRevokeVesting returns only unvested tokens to the original creator. The beneficiary retains its accrued vested entitlement and claim right.
func SettleFair
crossing ActionSettleFair closes a sale at its recorded hard-cap fill or scheduled end. It returns every unsold token to the creator and partitions deposits into buyer refunds, the creator's proceeds and the protocol's primary fee. The fee joins the bucket SweepFees pays; nothing is paid out here, so neither receiver can hold up settlement or buyer claims.
func SolvencyJSON
ActionSolvencyJSON is the realm's books in one currency: the balance it holds and what it owes, in total and by liability. fees is what SweepFees would pay now. Every movement of quote ends with balance >= owed, so a watcher that sees otherwise has found a fault; what the balance holds above owed was sent outside the entry points and is owed to no one. An empty key or one over 200 bytes panics "invalid currency"; a key that is neither ugnot nor a registered GRC20 aborts in the registry ("unknown token").
func SweepFees
crossing ActionSweepFees pays every fee recorded in one currency, creation fees and fair-sale primary fees alike, to the treasury of the current config, and returns the amount. Anyone can call it; the caller chooses neither the receiver nor the amount. A fee is only ever recorded once a treasury is named, and config never lets the treasury be removed.
func TermsJSON
ActionTermsJSON is what launching a token in a currency costs under the current config version: the fee a direct creation and a fair-sale creation attach, exactly; the most one fair sale may raise; and the primary fee a new sale pins. A fee of -1 means the currency has no terms. A creation names this version, so if the terms change before it lands it fails with "config changed" and takes nothing. Whether a lane takes new launches now is config's ActionStatusJSON.
func TokenLiability
Actionfunc VestingCount
Actionfunc VestingJSON
ActionVestingJSON is one vesting record: its schedule, who holds the claim right and who has been proposed to take it.
func GetAirdrop
Actionfunc GetFairBuyer
Actionfunc GetFairSale
Actionfunc GetVesting
Action4
type AirdropRecord
structAirdropRecord keeps the whole funded allocation encumbered until recipients claim. Claims never expire, and nothing sweeps or returns an unclaimed remainder.
type FairBuyerRecord
structtype FairSaleRecord
struct 1type FairSaleRecord struct {
2 Creator address
3 QuoteCurrency string
4 ConfigVersion int64
5 PrimaryFeeBPS int64
6 Allocation int64
7 LotSize int64
8 WalletCapLots int64
9 Caps fairmath.Caps
10 Schedule fairmath.Schedule
11 AllowlistRoot string
12 HoldingGates string
13 TotalLots int64
14 TotalDeposits int64
15 HardClosedAt int64
16 Cancelled bool
17 Settled bool
18 Succeeded bool
19 CloseAt int64
20 ClosePrice int64
21 SoldTokens int64
22 GrossQuote int64
23 CreatorQuote int64
24 ProceedsReleased bool
25 RefundQuote int64
26 UnsoldTokens int64
27 RefundPaid int64
28 TokensClaimed int64
29}FairSaleRecord fixes the sale terms and records funded whole-lot orders. Settlement splits GrossQuote into the primary fee, owed to the protocol, and CreatorQuote, owed to the creator: the fee is GrossQuote minus CreatorQuote. RefundPaid and TokensClaimed count what buyer claims have taken out of this sale, so no claim can pay more than the sale itself owes.
type VestingRecord
struct15
- chain stdlib
- chain/banker stdlib
- gno.land/p/nt/avl/v0 package
- gno.land/p/samcrew/launchpad/currency/v1 package
- gno.land/p/samcrew/launchpad/fairmath/v1 package
- gno.land/p/samcrew/launchpad/merkle/v1 package
- gno.land/p/samcrew/launchpad/meta/v1 package
- gno.land/p/samcrew/launchpad/safemath/v1 package
- gno.land/p/samcrew/launchpad/vesting/v1 package
- gno.land/r/nt/grc20reg/v0 realm
- gno.land/r/samcrew/launchpad/config/v1 realm
- gno.land/r/samcrew/launchpad/tokens/v1 realm
- strconv stdlib
- strings stdlib
- time stdlib