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

crowdfund state

Back to all declarations

RealmPath

untyped string

RealmPath is this realm's own path, used to build Render links.

Value

"/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/crowdfund"

Denom

untyped string

Denom is the only asset this realm holds.

Value

"ugnot"

MaxFeeBps

int64

MaxFeeBps is the hard ceiling on any success fee this realm could ever charge, enforced by the feeledger the realm is constructed with — a feeBps above it is refused by the primitive's own validation, not by a check in this file. 500 bps = 5%.

Value

500

SuccessFeeBps

int64

SuccessFeeBps is the fee actually snapshotted into every campaign at Launch: 100 bps = 1%, charged once, on CreatorClaim, on the raised amount, floor-rounded in the creator's favor. fee\_split precedent: the most conservative live fee in this portfolio is also 1%.

Value

100

FeeCollector

.uverse.address

FeeCollector receives withdrawn fees and swept surplus. Compile-time constant: there is no setter and no transfer path. It is the deploying namespace's address — stated plainly: the operator of this realm.

Value

<gnolang.StringValue>

MinGoal

int64

MinGoal keeps dust campaigns out: 1 GNOT.

Value

1000000

MinPledge

int64

MinPledge bounds pledge-table growth per GNOT of hostile capital (audit open question 1): at 0.01 GNOT per entry, bloating one campaign's table to even 10,000 entries costs 100 refundable-but- locked GNOT plus gas. Honest micro-backing survives: 0.01 GNOT is two orders of magnitude below MinGoal.

Value

10000

MinDurationBlocks

int64

MinDurationBlocks and MaxDurationBlocks bound a campaign's funding period, enforced structurally: they are the duebook's minDelay and maxDelay, so an out-of-range duration is refused by the primitive. At onyx-1's roughly 3-5s blocks, ~1,200 blocks is on the order of an hour or two, and ~1,300,000 blocks is on the order of 45-75 days.

Value

1200

MaxDurationBlocks

int64

MinDurationBlocks and MaxDurationBlocks bound a campaign's funding period, enforced structurally: they are the duebook's minDelay and maxDelay, so an out-of-range duration is refused by the primitive. At onyx-1's roughly 3-5s blocks, ~1,200 blocks is on the order of an hour or two, and ~1,300,000 blocks is on the order of 45-75 days.

Value

1300000

ClaimWindowBlocks

int64

ClaimWindowBlocks is how long after the deadline a successful creator may collect before the campaign becomes permissionlessly lapsable and the pot refundable. It is every campaign's deferral ttl.

Value

650000

MaxOpenCampaigns

untyped bigint

MaxOpenCampaigns caps simultaneously unsettled campaigns, via the duebook's own open-deferral cap. The AVAILABILITY BOUND this implies is documented rather than hidden: Launch is permissionless, so the cap is exhaustible in principle. What each unsettled slot costs an attacker is the mitigation — a failed campaign is permissionlessly settleable (SettleFailed) the moment its deadline passes, so holding a slot past its deadline requires MEETING THE GOAL, i.e. locking at least MinGoal of real capital per slot for the claim window. Filling the whole table therefore costs >= 1,024 GNOT locked for ~a month per cycle, against a realm whose existing campaigns keep working regardless. Accepted for a testnet deployment and recorded in the deployment record (audit finding Y1).

Value

(1024 <untyped> bigint)

MaxOpenPerCreator

int64

MaxOpenPerCreator bounds how much of the global cap one creator can occupy (permission\_registry R1 precedent: an uncapped per-principal count lets one key monopolize a shared bound).

Value

8

MaxTitleLen

untyped bigint

Input bounds. Both fields are free text and are sanitized before reaching markdown.

Value

(100 <untyped> bigint)

MaxMemoLen

untyped bigint

Input bounds. Both fields are free text and are sanitized before reaching markdown.

Value

(256 <untyped> bigint)

MaxRenderRows

untyped bigint

MaxRenderRows bounds the campaign list on the index page.

Value

(20 <untyped> bigint)

stateFunding

untyped string

Campaign states. statePaid, stateFailed, stateCancelled and stateLapsed are terminal: the campaign's deferral has been consumed and can never be consumed again.

Value

"funding"

statePaid

untyped string

Campaign states. statePaid, stateFailed, stateCancelled and stateLapsed are terminal: the campaign's deferral has been consumed and can never be consumed again.

Value

"paid"

stateFailed

untyped string

Campaign states. statePaid, stateFailed, stateCancelled and stateLapsed are terminal: the campaign's deferral has been consumed and can never be consumed again.

Value

"failed"

stateCancelled

untyped string

Campaign states. statePaid, stateFailed, stateCancelled and stateLapsed are terminal: the campaign's deferral has been consumed and can never be consumed again.

Value

"cancelled"

stateLapsed

untyped string

Campaign states. statePaid, stateFailed, stateCancelled and stateLapsed are terminal: the campaign's deferral has been consumed and can never be consumed again.

Value

"lapsed"

campaign

type

Value

crowdfund.campaign

self

.uverse.address

Value

<gnolang.StringValue>

campaigns

*v0.Tree

// padID(id) -> \*campaign

Open
OID
0deb15…3765:5
campaigns details

Inspect pointer

nextID

int64

Value

3

totalBacked

int64

Value

0

lifetimePledged

int64

Value

3050000

lifetimePaidOut

int64

// creator payouts, net of fee

Value

990000

lifetimeReturned

int64

// unpledges + refunds

Value

2050000

rejectStraySend

func()

rejectStraySend aborts when coins are attached to a non-payable call. This realm holds funds, so a stray send would become sweepable surplus, silently converting a user's coins into operator funds. Aborting reverts the transfer instead. Guarded on IsUserCall, not IsUser, because a MsgRun ephemeral can consume the OriginSend envelope before forwarding control; for a realm-routed call the envelope lands at the intermediary, so there is nothing here to reject and the guard deliberately fails open (treasury\_board documents the same scope).

Open
OID
0deb15…3765:27
rejectStraySend details

Inspect func

Launch

func(title string, memo string, goal int64, durationBlocks int64) int64

Launch opens a campaign and returns its id. Anyone may launch; the caller becomes the creator. The fee terms (SuccessFeeBps at this moment — a compile-time constant, so always SuccessFeeBps) are snapshotted into the campaign and are fixed from here on. The funding duration is given in blocks and must be within \[MinDurationBlocks, MaxDurationBlocks] — enforced by the duebook.

Open
OID
0deb15…3765:28
Launch details

Inspect func

Pledge

func(id int64)

Pledge backs a campaign with the attached coins. Direct EOA calls with -send only (the receipt-guaranteed shape); exactly one positive ugnot coin. Open while height \< deadline.

Open
OID
0deb15…3765:29
Pledge details

Inspect func

Unpledge

func(id int64)

Unpledge returns the caller's entire pledge while funding is still open. All-or-nothing means nothing is committed before the deadline, so backing out is always whole and always free.

Open
OID
0deb15…3765:30
Unpledge details

Inspect func

CreatorClaim

func(id int64)

CreatorClaim collects a successful campaign: creator only, from the deadline until the claim window closes, and only with the goal reached. Pays raised minus the snapshotted fee to the creator and accrues the fee. The duebook Claim consumes the campaign's deferral, so this can succeed at most once per campaign, ever.

Open
OID
0deb15…3765:31
CreatorClaim details

Inspect func

CreatorCancel

func(id int64)

CreatorCancel settles the caller's own campaign as cancelled and opens refunds. Permitted at any time while the settlement deferral is open — during funding, and equally after a successful deadline (renouncing the pot). The duebook Cancel is owner-gated and consumes the deferral.

Open
OID
0deb15…3765:32
CreatorCancel details

Inspect func

SettleFailed

func(id int64)

SettleFailed settles a campaign that reached its deadline with the goal unmet. Anyone may call it — there is nothing to steer: refunds were already open on this path, so the only effects are making the failure terminal and freeing the campaign's duebook slot (and its creator's cap slot) immediately instead of at the end of the claim window. This is what makes slot-squatting with unfunded campaigns pointless: holding a slot past the deadline requires meeting the goal, i.e. real locked capital. The deferral is consumed with the duebook's Claim under this realm's policy (goal unmet), which the primitive explicitly leaves to its consumer; the timing verdict (not due before the deadline) is the primitive's own.

Open
OID
0deb15…3765:33
SettleFailed details

Inspect func

Lapse

func(id int64)

Lapse settles a campaign whose claim window has closed. Anyone may call it — a lapsed campaign's pot belongs to its backers, and the caller is doing them (and the duebook's open-slot budget) a service. The duebook Expire refuses while the window is still open.

Open
OID
0deb15…3765:34
Lapse details

Inspect func

Refund

func(id int64)

Refund returns the caller's entire pledge from a campaign that will never pay its creator: cancelled, lapsed, or past its deadline with the goal unmet. Always whole, always fee-free. While a succeeded campaign is inside its claim window the pot is the creator's to collect, so Refund refuses — if the creator never collects, Lapse reopens this path.

Open
OID
0deb15…3765:35
Refund details

Inspect func

Prune

func(id int64)

Prune removes a settled campaign record that holds no coins, reclaiming its storage. Anyone may call it: the chain refunds the freed storage deposit to the pruning transaction, which is the incentive. A record with raised > 0 still carries backer entitlements and is not prunable.

Open
OID
0deb15…3765:36
Prune details

Inspect func

WithdrawFees

func() int64

WithdrawFees pays the entire accrued fee pot to the compile-time FeeCollector. Anyone may call it: the destination is fixed, so there is nothing for a caller to steer.

Open
OID
0deb15…3765:37
WithdrawFees details

Inspect func

SweepSurplus

func(denom string) int64

SweepSurplus sends out-of-band coins to the FeeCollector: for the pot denom, everything above tracked liabilities; for any foreign denom, the full balance. Tracked backer money and the fee pot are untouchable by construction (coinio.Sweep refuses to dip below the reserve). Anyone may call it.

Open
OID
0deb15…3765:38
SweepSurplus details

Inspect func

CampaignInfo

func(id int64) (creator .uverse.address, goal int64, raised int64, feeBps int64, createdAt int64, deadline int64, claimEnd int64, backers int, state string)
Open
OID
0deb15…3765:39
CampaignInfo details

Inspect func

CampaignTitle

func(id int64) string

CampaignTitle returns a campaign's raw title (unsanitized: callers rendering it into markdown must sanitize, as this realm's Render does).

Open
OID
0deb15…3765:40
CampaignTitle details

Inspect func

CampaignMemo

func(id int64) string

CampaignMemo returns a campaign's raw memo (same caveat as the title).

Open
OID
0deb15…3765:41
CampaignMemo details

Inspect func

Status

func(id int64) string

Status returns the human verdict for a campaign right now: "funding", "succeeded (awaiting creator claim)", "failed (refunds open)", "paid", "cancelled", or "lapsed".

Open
OID
0deb15…3765:42
Status details

Inspect func

PledgeOf

func(id int64, addr .uverse.address) int64

PledgeOf returns addr's live pledge in a campaign (0 if none, and 0 for settled campaigns whose pledge table has been dropped).

Open
OID
0deb15…3765:43
PledgeOf details

Inspect func

IsRefundable

func(id int64) bool

IsRefundable reports whether Refund would currently accept this campaign (for any backer with a live pledge).

Open
OID
0deb15…3765:44
IsRefundable details

Inspect func

NumCampaigns

func() int64

NumCampaigns returns how many campaigns have ever been launched. Prune removes records but never reuses ids.

Open
OID
0deb15…3765:45
NumCampaigns details

Inspect func

OpenCampaigns

func() int64

OpenCampaigns returns how many campaigns are currently unsettled.

Open
OID
0deb15…3765:46
OpenCampaigns details

Inspect func

OpenOf

func(addr .uverse.address) int64

OpenOf returns how many unsettled campaigns addr currently has.

Open
OID
0deb15…3765:47
OpenOf details

Inspect func

TotalBacked

func() int64

TotalBacked returns the B term: coins held for campaigns.

Open
OID
0deb15…3765:48
TotalBacked details

Inspect func

FeesAccrued

func() int64

FeesAccrued returns the F term: charged, not yet withdrawn.

Open
OID
0deb15…3765:49
FeesAccrued details

Inspect func

Liabilities

func() int64

Liabilities returns B + F — everything this realm owes.

Open
OID
0deb15…3765:50
Liabilities details

Inspect func

Held

func() int64

Held returns H: the ugnot actually at this realm's address.

Open
OID
0deb15…3765:51
Held details

Inspect func

Surplus

func() int64

Surplus returns H - (B + F) — out-of-band coins, sweepable.

Open
OID
0deb15…3765:52
Surplus details

Inspect func

Height

func() int64

Height returns the current chain height, the clock every deadline is measured against.

Open
OID
0deb15…3765:54
Height details

Inspect func

Render

func(path string) string

Render shows the realm at "" and a campaign page at "\<id>". Titles and memos are free text and pass through the ecosystem sanitizer before hitting markdown.

Open
OID
0deb15…3765:55
Render details

Inspect func

renderCampaign

func(path string) string
Open
OID
0deb15…3765:56
renderCampaign details

Inspect func

mustGet

func(id int64) *crowdfund.campaign
Open
OID
0deb15…3765:57
mustGet details

Inspect func

payBack

func(c *crowdfund.campaign, backer .uverse.address, event string)

payBack is the shared whole-pledge return path for Unpledge and Refund: debit the backer's entry and the campaign before the identical amount leaves the realm.

Open
OID
0deb15…3765:58
payBack details

Inspect func

refundable

func(c *crowdfund.campaign, now int64) bool

refundable: failed, cancelled and lapsed campaigns always; an unsettled campaign once its deadline has passed with the goal unmet. A succeeded campaign inside its claim window is NOT refundable — the pot is the creator's to collect until Cancel or Lapse says otherwise.

Open
OID
0deb15…3765:59
refundable details

Inspect func

status

func(c *crowdfund.campaign, now int64) string
Open
OID
0deb15…3765:60
status details

Inspect func

pledgeOf

func(c *crowdfund.campaign, key string) int64
Open
OID
0deb15…3765:61
pledgeOf details

Inspect func

backerCount

func(c *crowdfund.campaign) int
Open
OID
0deb15…3765:62
backerCount details

Inspect func

creatorOpen

func(key string) int64
Open
OID
0deb15…3765:63
creatorOpen details

Inspect func

setCreatorOpen

func(key string, n int64)
Open
OID
0deb15…3765:64
setCreatorOpen details

Inspect func

decCreatorOpen

func(key string)
Open
OID
0deb15…3765:65
decCreatorOpen details

Inspect func

bps

func(n int64) string

bps renders a basis-point figure as a human percentage, exactly.

Open
OID
0deb15…3765:67
bps details

Inspect func

percent

func(raised int64, goal int64) string

percent renders raised/goal as an integer percentage (floor). goal >= MinGoal > 0 by construction, so no divide guard is needed.

Open
OID
0deb15…3765:68
percent details

Inspect func

padID

func(id int64) string

padID encodes an id so avl's lexical order matches numeric order.

Open
OID
0deb15…3765:69
padID details

Inspect func

zeros

untyped string

Value

"00000000000000000000"

checkedAdd

func(a int64, b int64) (int64, bool)

checkedAdd returns a+b and reports whether the addition did not overflow int64.

Open
OID
0deb15…3765:70
checkedAdd details

Inspect func
RealmPath : untyped string ="/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/crowdfund"
Denom : untyped string ="ugnot"
MaxFeeBps : int64 =500
SuccessFeeBps : int64 =100
FeeCollector : .uverse.address =<gnolang.StringValue>
MinGoal : int64 =1000000
MinPledge : int64 =10000
MinDurationBlocks : int64 =1200
MaxDurationBlocks : int64 =1300000
ClaimWindowBlocks : int64 =650000
MaxOpenCampaigns : untyped bigint =(1024 <untyped> bigint)
MaxOpenPerCreator : int64 =8
MaxTitleLen : untyped bigint =(100 <untyped> bigint)
MaxMemoLen : untyped bigint =(256 <untyped> bigint)
MaxRenderRows : untyped bigint =(20 <untyped> bigint)
stateFunding : untyped string ="funding"
statePaid : untyped string ="paid"
stateFailed : untyped string ="failed"
stateCancelled : untyped string ="cancelled"
stateLapsed : untyped string ="lapsed"
campaign : type =crowdfund.campaign
self : .uverse.address =<gnolang.StringValue>
campaigns : *v0.Tree Inspect
nextID : int64 =3
openByCreator : *v0.Tree Inspect
totalBacked : int64 =0
lifetimePledged : int64 =3050000
lifetimePaidOut : int64 =990000
lifetimeReturned : int64 =2050000
ledger : *feeledger.Ledger Inspect
book : *duebook.Book Inspect
init.31 : func() Inspect
rejectStraySend : func() Inspect
Launch : func(title string, memo string, goal int64, durationBlocks int64) int64 Inspect
Pledge : func(id int64) Inspect
Unpledge : func(id int64) Inspect
CreatorClaim : func(id int64) Inspect
CreatorCancel : func(id int64) Inspect
SettleFailed : func(id int64) Inspect
Lapse : func(id int64) Inspect
Refund : func(id int64) Inspect
Prune : func(id int64) Inspect
WithdrawFees : func() int64 Inspect
SweepSurplus : func(denom string) int64 Inspect
CampaignInfo : func(id int64) (creator .uverse.address, goal int64, raised int64, feeBps int64, createdAt int64, deadline int64, claimEnd int64, backers int, state string) Inspect
CampaignTitle : func(id int64) string Inspect
CampaignMemo : func(id int64) string Inspect
Status : func(id int64) string Inspect
PledgeOf : func(id int64, addr .uverse.address) int64 Inspect
IsRefundable : func(id int64) bool Inspect
NumCampaigns : func() int64 Inspect
OpenCampaigns : func() int64 Inspect
OpenOf : func(addr .uverse.address) int64 Inspect
TotalBacked : func() int64 Inspect
FeesAccrued : func() int64 Inspect
Liabilities : func() int64 Inspect
Held : func() int64 Inspect
Surplus : func() int64 Inspect
Address : func() .uverse.address Inspect
Height : func() int64 Inspect
Render : func(path string) string Inspect
renderCampaign : func(path string) string Inspect
mustGet : func(id int64) *crowdfund.campaign Inspect
payBack : func(c *crowdfund.campaign, backer .uverse.address, event string) Inspect
refundable : func(c *crowdfund.campaign, now int64) bool Inspect
status : func(c *crowdfund.campaign, now int64) string Inspect
pledgeOf : func(c *crowdfund.campaign, key string) int64 Inspect
backerCount : func(c *crowdfund.campaign) int Inspect
creatorOpen : func(key string) int64 Inspect
setCreatorOpen : func(key string, n int64) Inspect
decCreatorOpen : func(key string) Inspect
itoa : func(n int64) string Inspect
bps : func(n int64) string Inspect
percent : func(raised int64, goal int64) string Inspect
padID : func(id int64) string Inspect
zeros : untyped string ="00000000000000000000"
checkedAdd : func(a int64, b int64) (int64, bool) Inspect