# Crowdfund
> ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline (Solidity→Gno port). Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md).
---
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.
## Transactions
- `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.
## Example
```
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).
<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->
---
Part of **[moul/gno-contracts](https://github.com/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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).
<!-- END GNOCONTRACTS FOOTER -->
Claim(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int)
Launch(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, goal uint64, durationBlocks int) int
Pledge(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int, amount uint64)
Refund(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int)
Render(path string) string
Unpledge(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id int, amount uint64)
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.