const VenueGnoswap, VenueZdex
ListVenue IDs (compile-time switch in tryListVenue). Adding a new DEX means a new case + adapter file and a new pad version — Gno cannot dynamically import by path string.
Package pad is gnomemepad: a self-contained meme launchpad for gno.land.
Package pad is gnomemepad: a self-contained meme launchpad for gno.land.
1CreateWithVenue (bond + venue-aware GNS escrow) -> GRC20 + WUGNOT curve -> Graduate
2 -> internal CPMM; then either:
3 gnoswap: RetryList / RetryListGnoswap (escrowed GNS + WUGNOT inventory)
4 zdex: ReleaseListSeed -> EOA CreatePool -> ConfirmZdexList
Production: Buy/Sell/Swap* use WUGNOT (push-pay + prepaid credits). Payment: user wugnot.Transfer(pad, amount) then Buy. Create fee: gnoswap preference locks ListFeeGns; zdex preference locks 0. DefaultListVenue source = zdex; Pearl may SetDefaultListVenue(gnoswap) after deploy. Unit tests (testSkipBanker): OriginSend ugnot as collateral units. Tokens are real GRC20 (mint on buy, burn on sell).
ListVenue IDs (compile-time switch in tryListVenue). Adding a new DEX means a new case + adapter file and a new pad version — Gno cannot dynamically import by path string.
1const (
2 // Token economics
3 TotalSupply int64 = 1_000_000_000
4 CurveSupply int64 = 800_000_000 // sold on bonding curve
5 // PoolSeed is legacy. Graduation sizes LP tokens to curve spot
6 // (raised * VirtualToken / VirtualUgnot); unsold remainder = LeftoverTokens.
7 PoolSeed int64 = 200_000_000
8
9 // Virtual constant-product seed (Pump-style).
10 // Max net raise when selling full CurveSupply:
11 // R = VirtualUgnot0 * CurveSupply / (VirtualToken0 - CurveSupply)
12 // Mainnet: VU0≈102.375e9 + VT0≈1.073e9 => max raise ≈300k GNOT so
13 // DefaultGraduationThreshold 300_000 GNOT is reachable before sold-out.
14 VirtualUgnot0 int64 = 102_375_071_625 // mainnet: max raise ≥ 300k GNOT
15 VirtualToken0 int64 = 1_073_000_191 // virtual token side
16
17 // Default graduation raise (ugnot). Live value starts here in Init;
18 // protocol may call SetGraduationThreshold afterward.
19 GraduationThreshold int64 = 300_000_000_000 // 300_000 GNOT (SetGraduationThreshold later)
20
21 // Fees: 1.20% total. Of the fee: 40% creator, 40% protocol, 20% LP/k remainder.
22 FeeBPS int64 = 120
23 CreatorFeeShareBPS int64 = 4000
24 ProtocolFeeShareBPS int64 = 4000
25
26 // Fallback create bond for unit tests / if bond realm unavailable.
27 // Production pad uses createbond.CurrentBondUgnot() (see bond package).
28 // Sapphire normal bond = 2 GNOT; promo ~ $20 in ugnot set on bond.StartPromo.
29 CreateBondUgnot int64 = 150_000_000 // 150 GNOT fallback; live = bond realm
30 BondRefundBuyers int = 5
31 BondRefundMinRaised int64 = 5_000_000 // >=5 GNOT raised
32 BondRefundMaxHeights int64 = 100_000
33
34 // Anti-snipe: first N heights, max cumulative tokens per address (BPS of TotalSupply).
35 AntiSnipeHeights int64 = 20
36 AntiSnipeMaxBuyBPS int64 = 500 // 5% per address in window
37
38 // Status
39 StatusCurve = 0
40 StatusGraduated = 1
41
42 // Trade history ring buffer.
43 MaxTradeHistory = 128
44 // Trade sides stored in history
45 TradeSideBuy = 0
46 TradeSideSell = 1
47 TradeSideOpen = 2 // initial listing mark
48
49 DenomUgnot = "ugnot"
50
51 // --- Gnoswap auto-list (Sapphire) ---
52 // Curve collateral is WUGNOT (Buy TransferFrom). At graduate, pad already holds
53 // raised WUGNOT for LP - no realm self-wrap needed.
54 // CreatePool fee is fixed in GNS (typically 100e6 = 100 GNS):
55 // Fee = pre-funded GNS on pad OR surplus WUGNOT (fees retained) ExactOut -> GNS
56 GnoswapFeeTier uint32 = 3000 // 0.3% meme tier
57 GnoswapTickSpacing int32 = 60
58 GnoswapMinTick int32 = -887272
59 GnoswapMaxTick int32 = 887272
60 // Max WUGNOT used as ExactOut maxIn for fee buy (ceiling / slippage).
61 // Prefer pre-funding >=100 GNS on pad so LP depth stays = raised.
62 GnoswapMaxFeeWugnot int64 = 1_500_000_000 // 1500 GNOT
63
64 // Create-time GNS list fee escrow (padv20+).
65 // Creator must Transfer >= ListFeeGns free GNS to pad before Create.
66 // Locked per-launch until Gnoswap list consumes it, or ClaimListFee refunds creator.
67 // Matches typical gnspool.GetPoolCreationFee() (100 GNS, 6 decimals).
68 ListFeeGns int64 = 100_000_000
69)AdenaPathOf returns the grc20reg / Adena token key: packagePath.SYMBOL (Token.ID is packagePath.SYMBOL.seq - Adena rejects that form).
AdminInfo is a single-line dashboard snapshot for the ops UI:
1protocolAddr|pendingFees|paidFees|reservedUgnot|launchCount|pointsOn|inited|padAddr
pointsOn/inited are 0|1.
Allowance returns how many tokens `spender` may TransferFrom from `owner` (same GRC20 semantics as wugnot/gns.Allowance, keyed by launch id).
Approve sets GRC20 allowance so DEX/contracts can TransferFrom.
Buy spends WUGNOT on the bonding curve; credits tokens. amountWugnot: max to spend (may overpay). UI: Deposit + Transfer(pad, amt) + Buy. Overpay stays as claimable prepaid — ClaimWugnot anytime (incl. after list). minTokensOut: slippage floor (0 = disabled). Auto-graduates at threshold or sold-out.
Production: collateral is real WUGNOT on pad -> Graduate can auto-list Gnoswap. Tests (testSkipBanker): amountWugnot ignored; OriginSend ugnot is used as units.
Last-fill (no overshoot):
If the curve is already sold out (or raise already filled), Buy refunds the full take and graduates when ready - no panic so users are not stuck mid-tx.
ClaimCreatorFees withdraws accrued creator fees for a launch. Only the token creator may claim. Fees stay on pad until claimed.
ClaimListFee refunds Create-time GNS escrow to the token creator if still unlisted. Use when graduate/list will not complete or creator abandons listing.
ClaimProtocolFees withdraws pending protocol fees to protocolAddr. Only the current protocol treasury key may call (same wallet that Init'd, unless TransferProtocol was used).
ClaimWugnot withdraws all of the caller's prepaid WUGNOT credit to their wallet. Safe after Buy overpay or after graduate/list — excess stays claimable until claimed.
ConfirmZdexList marks a launch listed on zdex after EOA CreatePool succeeded. poolId e.g. "ugnot|SYMBOL" (must be non-empty; no on-chain pool verify). Creator or protocol. Prefer ReleaseListSeed first when pad still holds LP seed.
Create deploys a fair-launch meme. Create bond (bond realm / fallback const) is a platform fee credited to protocol immediately (not refundable escrow). Also locks ListFeeGns free GNS when venue requires it (creator Transfer GNS first). No pre-mint; all tradeable float starts on the bonding curve.
CreateBondRequired is a public alias for UIs / qeval (same as requiredCreateBond).
CreateWithVenue is Create + PreferredVenue in one MsgCall (fee escrow follows venue). venueId: "zdex" → no GNS list escrow; "gnoswap" → ListFeeRequired GNS.
DefaultListVenue returns the venue id used when callers pass "".
FeeInfo returns protocolAddr|pendingUgnot|paidUgnot for UIs.
FreeGns returns free|have|reserved for UI preflight (GNS list fee).
FreeWugnot is free|have|reserved|totalCredit for UI preflight.
GRC20Bank returns the underlying *grc20.Token for interop (metadata / external DEX). Does not expose PrivateLedger - mint/burn stay pad-only.
GnoswapListedOf reports whether a launch was auto-listed on Gnoswap.
GnoswapNoteOf returns the listing status note.
GnoswapPoolPathOf returns the Gnoswap pool path after listing (or empty).
Graduate permissionlessly moves a ready curve into a permanently locked CPMM. Ready when RaisedUgnot >= graduationThreshold(), or when RealSold >= CurveSupply with RaisedUgnot > 0 (sold-out before threshold - escape hatch for unreachable raise).
GraduationThresholdLive returns the live raise target (ugnot) for UIs/qeval.
Init sets the protocol treasury. First EOA caller becomes fee recipient (protocolAddr). Protocol trade fees accrue on-pad until ClaimProtocolFees (treasury only) or PushProtocolFees (anyone may push to treasury). Creator fees always need ClaimCreatorFees by the token creator.
Deploy note: call Init with the wallet that should receive protocol fees (or TransferProtocol later). Gnoswap CreatePool GNS fee is paid to Gnoswap, not to this treasury.
IsProtocol reports whether addr is the current treasury (for UI gating).
LaunchInfo returns a single-line pipe-delimited summary for UIs/indexers:
1id|name|symbol|status|raised|sold|buyers|creatorFees|poolUgnot|poolToken|uri|creator|virtualUgnot|virtualToken|created|tokenID|gnoswapReady|gnoswapListed|gnoswapPoolPath|gnoswapNote|listVenue
status: 0=curve 1=graduated; gnoswapReady/listed: 0|1 gnoswapNote: optional (padv12+); pipes stripped for delimiter safety. listVenue: optional (padv23+); empty if unlisted.
ListBuyers returns unique buyer addresses (one per line), capped for query size. Only addresses that bought at least once on this pad (UniqueBuyers). Not full GRC20 holders who received tokens via transfer.
ListFeeRequired is a public alias for UIs / qeval.
ListFeeRequiredFor is venue-aware Create fee for UI preflight.
ListIDs returns newline-separated launch IDs (sorted by AVL key / creation order).
ListNeed is the public query for the Token list wizard (default venue).
ListNeedFor is venue-aware; only gnoswap has a Need adapter today.
ListNoteOf returns the listing status note.
ListPoolPathOf returns the pool path after listing.
ListSeedReleasedOf reports whether ReleaseListSeed already ran.
ListVenueOf returns the venue id used for a successful list (or "").
ListVenues returns newline-separated "id|label|enabled|feeHint" (enabled 0|1).
ListedOf reports whether the launch is listed on any venue.
PadAddress returns this pad realm's bech32 package address (fund WUGNOT here).
ParamsInfo returns parameters for UI display. total|curve|poolSeed|gradThreshold|feeBps|createBond|listFeeGns createBond is live from bond realm when not in unit-test mode. listFeeGns: Create-time GNS escrow required (padv20+).
PointsEnabled reports whether pad notifies pointsv2 after trades/creates.
PreferredVenueOf returns the Create-time / SetPreferredVenue target.
PrepaidBalance returns caller's claimable WUGNOT credit on this pad.
PrepaidOf returns claimable credit for an address (read helper).
ProtocolAddress returns the current protocol treasury address (bech32).
ProtocolBondFees returns pending create-bond bank ugnot (subset of ProtocolFees).
ProtocolFeesPaid returns lifetime ugnot already paid out to the treasury.
PushProtocolFees sends pending protocol fees to protocolAddr. Permissionless: anyone may call so treasury can be paid without the protocol key signing (still only pays the configured protocolAddr).
ReleaseListSeed sends graduated internal-CPMM seed to the creator for EOA zdex CreatePool:
PoolUgnot/PoolToken kept as listing-size record; reservedWugnot skips via ListSeedReleased. Disables internal SwapBuy/Sell. Creator or protocol may call; assets always go to creator.
RemainingRaiseUgnot is net ugnot still needed to hit graduationThreshold() (0 if met/over).
ReservedUgnot is ugnot the pad must keep for markets + pending claims.
RetryList lists a graduated launch on the chosen venue. Permissionless EOA MsgCall. Uses PoolUgnot / PoolToken (curve-spot sized). venueId: empty → PreferredVenue → DefaultListVenue(); unknown/disabled → soft-fail note.
RetryListGnoswap is the Gnoswap-specific wrapper (compat for existing UI).
Sell burns curve tokens and pays WUGNOT (fee on output). minWugnotOut: slippage floor (0 = disabled). User may wugnot.Withdraw to ugnot.
SetDefaultListVenue sets the default list venue (protocol only).
SetGraduationThreshold updates the live raise target (ugnot, 1 GNOT = 1e6). Protocol/deploy wallet only. Affects open curve launches (remaining raise / ready).
SetListFeeGns updates Create-time GNS escrow required for new launches. Protocol/deploy wallet only. Does not change already-escrowed launches.
SetListVenue registers or updates venue metadata (protocol only). Does not add compile-time dispatch — unknown ids stay non-listable until tryListVenue gains a case in a future pad version.
SetPointsEnabled toggles pointsv2 notifications (protocol admin only). pointsv2 must AllowPad(this package path) or OnTrade/OnCreate will panic and revert the trade.
SetPreferredVenue sets the DEX target used when RetryList(id, "") is called. Creator or protocol only; locked once listed. Syncs Create-time GNS escrow (gnoswap locks ListFeeRequired; zdex unlocks/refunds escrow).
SwapBuy buys tokens from the graduated internal pool with WUGNOT. amountWugnot: max to spend (Approve pad). minTokensOut: slippage (0 = off). Disabled when listed on Gnoswap (trade via router).
SwapSell sells tokens into the graduated pool for WUGNOT. minWugnotOut: slippage floor (0 = disabled).
TokenIDOf returns the GRC20 Token.ID() for a launch.
TradeCount returns number of stored chart samples for a launch.
TradeHistory returns newline-separated chart points:
1height|side|ugnot|tokens|priceScaled
side: 0=buy 1=sell 2=open/graduate. Ordered oldest -> newest.
Transfer moves GRC20 tokens between addresses (user-initiated).
TransferFrom spends allowance: spender = MsgCall EOA caller. Enables DEX / routers that hold allowance from Approve.
TransferProtocol rotates the protocol fee recipient (current protocol only). Pending protocolFees stay on pad until claimed/pushed to the *new* address.
WithdrawProtocolUgnot lets the treasury pull free ugnot from the pad bank (e.g. raised backlog after Gnoswap list, to re-wrap as WUGNOT inventory). Capped by free balance; panics if amount > free.
1type Launch struct {
2 ID string
3 Name string
4 Symbol string
5 URI string
6 Creator address
7 Status int
8 Created int64 // block height
9
10 // GRC20 (mint/burn only via pad-owned private ledger)
11 token *grc20.Token
12 ledger *grc20.PrivateLedger
13 TokenID string // Token.ID() - registry / Gnoswap identity
14
15 // Virtual curve reserves
16 VirtualUgnot int64
17 VirtualToken int64
18 RealSold int64 // tokens sold on curve (<= CurveSupply)
19 RaisedUgnot int64 // net ugnot collateral in curve (excl. fee vaults)
20
21 // Real pool (post-grad); LP permanently locked - no remove path
22 // PoolToken is pad-internal reserve sized to curve spot (not always all unsold).
23 // LeftoverTokens = (TotalSupply - RealSold) - PoolToken; minted to pad at list, not LP'd.
24 PoolUgnot int64
25 PoolToken int64
26 LeftoverTokens int64
27
28 CreatorFees int64
29 BondUgnot int64
30 BondRefunded bool
31 UniqueBuyers avl.Tree // address -> true
32 BuyerCount int
33 // snipeBought: address -> cumulative tokens bought during anti-snipe window
34 snipeBought avl.Tree
35
36 // Gnoswap listing state
37 GnoswapReady bool // graduated; token is listable / listed
38 GnoswapListed bool // true when CreatePool+Mint succeeded on Gnoswap
39 GnoswapNote string // human status / failure reason
40 GnoswapPoolPath string
41 GnoswapPositionID uint64
42 // FeeWugnotSpent / LiqWugnotUsed: inventory spent at graduate (1:1 vs raised ugnot notionally)
43 FeeWugnotSpent int64
44 LiqWugnotUsed int64
45
46 // ListFeeGns: Create-time GNS escrow for Gnoswap CreatePool fee (padv20+).
47 // Consumed on successful list; ClaimListFee refunds creator if still unlisted.
48 ListFeeGns int64
49 ListFeeConsumed bool // true after list paid CreatePool fee from escrow
50
51 // ListVenue: which DEX adapter succeeded (e.g. "zdex" / "gnoswap"). Empty if unlisted.
52 ListVenue string
53 // PreferredVenue: chosen at Create (or SetPreferredVenue). Used when RetryList venueId == "".
54 PreferredVenue string
55 // ListSeedReleased: PoolUgnot (WUGNOT) + PoolToken (minted GRC20) sent to creator for EOA zdex CreatePool.
56 ListSeedReleased bool
57
58 // Chart history (ordered AVL keys)
59 Trades avl.Tree // tradeKey -> *Trade
60 NextTrade int64
61}Launch is one meme market: curve phase then locked pool phase. token/ledger are unexported so external packages cannot Mint/Burn via field access.
Trade is one price sample for charts (capped history per launch).