const MaxTitleLen, MaxDescriptionLen, MaxLinkLen, MaxNoteLen, MaxSlots, MaxReviewers, MaxTags, MaxTagLen
Limits keep campaigns renderable and every transition bounded in gas.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package campaign is the state machine behind Guildhall campaigns: bounties with a fixed reward per claim and a fixed ...
Package campaign is the state machine behind Guildhall campaigns: bounties with a fixed reward per claim and a fixed number of slots, for small tasks many people can do (write a post, translate a page, file a bug report).
Like gno.land/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/guildhall/bounty, it holds no funds and moves no coins. Transitions validate who is acting, mutate the campaign, and return the transfers the escrow realm must make.
The poster escrows Reward × Slots. Anyone except the poster and the reviewers can claim with a link to proof of the work; a pending claim reserves a slot. Any one reviewer approves (pays the reward) or rejects (frees the slot). Each address holds at most one pending or approved claim.
1Open ──Close (poster, or anyone after the deadline)──▶ Closed (free slots refunded)
2Open ──(every slot paid)──▶ Closed
3
4Claim ──Approve──▶ Approved (reward paid)
5 └────Reject───▶ Rejected (slot freed; refunded if the campaign is closed)
Pending claims can still be reviewed after a campaign closes.
Limits keep campaigns renderable and every transition bounded in gas.
New validates p and returns a funded, open campaign. When no reviewers are given, the poster reviews alone.
ParseClaimStatus is the inverse of ClaimStatus.String.
ParseStatus is the inverse of Status.String.
1type Campaign struct {
2 ID uint64
3 Poster address
4 Title string
5 Description string
6 Link string
7 Tags []string
8 Denom string
9 IsGRC20 bool
10 Reward int64
11 Slots int
12 Reviewers []address
13 Deadline time.Time // zero: no deadline
14 Status Status
15 CreatedAt time.Time
16 ClosedAt time.Time
17
18 Paid int // approved claims
19 Pending int // claims awaiting review
20 Rejected int
21 Refunded int // slots returned to the poster
22
23 claims avl.Tree // padded claim number -> *Claim
24 byClaimant avl.Tree // address -> latest claim number (int)
25}Campaign is a pool of identical, individually paid tasks.
Approve pays a pending claim. Any one reviewer may approve. When the last slot is paid, the campaign closes.
Claim records that claimant did the task, with a link to proof, and reserves a slot. It returns the claim number.
ClaimCount is the number of claims ever submitted.
ClaimOf returns addr's most recent claim, or nil.
Claims returns up to limit claims, newest first, after skipping offset claims. With a status filter, only matching claims are counted.
Close stops new claims and refunds every slot that is neither paid nor awaiting review. The poster can close at any time; anyone can close once the deadline has passed.
Escrowed is the amount still held for this campaign.
Expired reports whether the campaign has a deadline that has passed.
FreeSlots is how many more claims an open campaign can take.
GetClaim returns claim number (1-based), or nil.
IsReviewer reports whether addr may approve and reject claims.
PaidOut is the amount paid to claimants so far.
1func (c *Campaign) Reject(caller address, number int, reason string, now time.Time) ([]Payout, error)Reject turns down a pending claim and frees its slot. If the campaign has closed, the slot's reward goes back to the poster. The claimant may claim again while the campaign is open.
Total is the amount escrowed when the campaign was posted.
Claim is one person's request to be paid for doing the task once.
ClaimStatus is the state of a single claim.
Params are the inputs to New.
Payout is a transfer the escrow realm must execute. Claim is the claim number for work payouts and 0 for refunds.
PayoutKind says why escrowed funds move.
Status is the lifecycle state of a campaign.