func Claim
crossing ActionClaim lets the creator take the funds if the goal was met after the deadline.
Package crowdfund is an accounting-only port of the classic Solidity Kickstarter-style crowdfunding contract to a gno...
⚠️ Experimental — generated with no human supervision by the daily MCP pipeline (Solidity→Gno port). Not audited. See r/moul/x/daily.
A gno.land realm port of the classic Solidity Kickstarter-style crowdfunding
contract. It keeps the same lifecycle — launch a campaign with a goal and a
deadline, let backers pledge and unpledge, then either let the creator claim on
success or let backers refund on failure — but models everything as plain
uint64 accounting (no real coin transfer), the idiomatic Gno equivalent of the
Solidity mapping(address => uint) balances.
Deadlines use runtime.ChainHeight() (block height) instead of
block.timestamp, msg.sender becomes unsafe.PreviousRealm().Address(),
require becomes panic, and campaigns live in an ordered avl.Tree so
Render lists them deterministically with a ▓░ progress bar.
Launch(goal uint64, durationBlocks int) int — create a campaign (returns id); deadline = current height + duration.Pledge(id int, amount uint64) — back a campaign before its deadline.Unpledge(id int, amount uint64) — withdraw part/all of your pledge before the deadline.Claim(id int) — creator claims funds after the deadline if pledged >= goal.Refund(id int) — backer reclaims their pledge after the deadline if the goal was missed.Launch(1000, 100) // campaign #1, goal 1000, ends 100 blocks from now -> returns 1
Pledge(1, 400) // back campaign #1 with 400
Pledge(1, 700) // total now 1100 (>= goal)
Unpledge(1, 100) // change of mind: total back to 1000
// ... after block height passes the deadline ...
Claim(1) // creator claims 1000 (goal met)
Read-only Render("") shows every campaign with its progress bar, goal,
pledged total, deadline block and state (Active / Funded / Funded (claimed) /
Failed).
State moved from a hand-rolled avl.Tree + nextID + zero-padding helper to
p/moul/kit/store, which keys entries by
seqid instead of a fixed-width decimal string.
v0 padded ids to width 12. Past that width the padding stops and the tree
orders "1000000000000" before "999999999999", so every list this realm
renders would be wrong from that entry on. store keys are 8 big-endian bytes
whose order is numeric for every uint64, so there is no width left to outgrow.
Campaign loses its ID field, which the store now owns, and the realm's local
mustGet becomes one line: the store's labelled MustGet panics
campaign #7 not found where v0 said only campaign not found. Each
campaign keeps its own address-keyed pledges tree, which the store does not
cover. Campaign ids already started at 1, so nothing shifts.
This is a storage change, which under this repo's versioning rule is a
compatibility change, hence a new version rather than an edit in place.
v0 stays live and untouched.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
Dependency graph:

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.
Package crowdfund is an accounting-only port of the classic Solidity Kickstarter-style crowdfunding contract to a gno.land realm.
A creator Launches a campaign with a funding goal and a duration (in blocks). Backers Pledge (and may Unpledge before the deadline). After the deadline the creator can Claim if the goal was met, otherwise backers can Refund.
No real coin moves: pledges are tracked as plain uint64 accounting, exactly like the mapping(address => uint) balances of the Solidity original.
Claim lets the creator take the funds if the goal was met after the deadline.
Launch creates a new campaign owned by the caller and returns its id.
Pledge backs campaign id with amount (before the deadline).
Refund returns the caller's pledge if the campaign failed after the deadline.
Render shows all campaigns with a progress bar, goal, pledged and state.
Unpledge withdraws amount from the caller's pledge (before the deadline).
Campaign holds the state of a single crowdfunding campaign. It carries no ID field: the id belongs to the store, which hands it back on lookup and iteration.