questmaster source realm
Package questmaster is a GNOT bounty board. A poster locks GNOT on a quest, a builder takes it and submits a link to ...
Package questmaster is a GNOT bounty board. A poster locks GNOT on a quest, a builder takes it and submits a link to the work, and the poster approves (paying the builder) or rejects (reopening the quest). If the poster stays silent past the review window (about 7 days), the builder can claim the payout. A poster can cancel an open quest for a refund, or close a claimed or submitted one: the builder keeps their turn, and if it ends without approval the reward goes back to the poster.
The rules live in the pure package p/escrow. This realm stores quests, holds the coins and moves them only as an escrow move tells it to.
Callers (v1): every state-changing function accepts only a direct user call (`gnokey maketx call`, i.e. cur.Previous().IsUserCall()). Calls from other realms and from `maketx run` scripts are refused. This is what makes the unsafe.OriginSend() checks sound: for a direct user call, the coins sent with the call are guaranteed to have landed in this realm. Realm or DAO callers may be supported in a later version.
There is no admin, owner, pause, upgrade or sweep function. Nobody can move escrowed coins except through the quest moves below.
Coins sent straight to the realm address with a bank send (not through PostQuest) are not tracked by any quest and cannot be moved by anyone, so they are lost. On chain the guarantee is therefore: realm balance >= the locked total, with equality when nobody sends coins outside PostQuest. The pages and GetTotals use only the tracked numbers, never the balance.
Nothing here hands out a pointer to stored state: read functions return plain values (QuestView, Totals, []uint64, strings).
5
const ErrNotUserCall, ErrNoCoins, ErrSeveralCoins, ErrWrongDenom, ErrRewardTooLow, ErrCoinsNotTaken, ErrUnknownQuest
1const (
2 ErrNotUserCall = "questmaster: only direct user calls (gnokey maketx call) are accepted"
3 ErrNoCoins = "questmaster: send the reward in ugnot with the call"
4 ErrSeveralCoins = "questmaster: send exactly one coin (ugnot)"
5 ErrWrongDenom = "questmaster: the reward must be in ugnot"
6 ErrRewardTooLow = "questmaster: the reward is below the minimum of 1 GNOT (1000000ugnot)"
7 ErrCoinsNotTaken = "questmaster: this function does not take coins; send none"
8 ErrUnknownQuest = "questmaster: unknown quest id"
9)Panic messages for the realm's own checks. Escrow rule violations panic with the escrow error's text (prefix "escrow: ").
const ApproxBlockMillis
ApproxBlockMillis is the block time used for the approximate times on the pages (measured about 3.4 to 3.5 s on Onyx and mainnet in Nov 2026).
const PageSize
PageSize is the number of quests per list page.
const SourceRepo
SourceRepo is where the source code is published, shown in the footer of every page.
19
func AllQuestIDs
ActionAllQuestIDs lists ids of all quests, newest first.
func ApproveWork
crossing ActionApproveWork accepts the submitted work and pays the reward to the builder. Only the poster.
func CancelQuest
crossing ActionCancelQuest is the poster's way out. Only the poster.
- Open quest: it ends at once and the reward is refunded.
- Claimed or Submitted quest: it is marked as closing and no coins move. The builder keeps their turn (submit, approval, timeout payout); when the turn ends without approval (unclaim, release after the work deadline, or reject), the quest ends and the reward goes back to the poster instead of the quest opening again.
func ClaimPayout
crossing ActionClaimPayout pays the builder when the poster has not answered within the review window. Only the builder, from the block after the review deadline.
func ClaimQuest
crossing ActionClaimQuest takes an Open quest. The poster cannot claim their own quest.
func CountByBuilder
ActionCountByBuilder returns how many quests addr has ever claimed.
func CountByPoster
ActionCountByPoster returns how many quests addr has posted.
func OpenQuestIDs
ActionOpenQuestIDs lists ids of Open quests, newest first. offset skips that many; at most MaxPageSize ids are returned whatever limit is.
func PaidQuestIDs
ActionPaidQuestIDs lists ids of Paid quests, newest first (by quest id).
func PostQuest
crossing ActionPostQuest creates a quest. Send the reward with the call as exactly one coin of ugnot, at least MinReward. workBlocks is the builder's work window in blocks (escrow.MinWorkBlocks to escrow.MaxWorkBlocks). Returns the new id.
func QuestIDsByBuilder
ActionQuestIDsByBuilder lists ids of quests addr has ever claimed, newest first. It is a history: a quest stays listed after the builder unclaims it, is released or is rejected, even if someone else builds it later. Use GetQuest(id).Builder for the current builder.
func QuestIDsByPoster
ActionQuestIDsByPoster lists ids of quests posted by addr, newest first.
func RejectWork
crossing ActionRejectWork refuses the submitted work with a reason. Its public reject count goes up. The quest opens again, or, if the poster closed it, ends with a refund to the poster. Only the poster, up to and including the review deadline block.
func ReleaseQuest
crossing ActionReleaseQuest ends the builder's turn on a Claimed quest whose work deadline has passed. Anyone may call it. The quest opens again, or, if the poster closed it, ends with a refund to the poster.
func Render
Render returns the gnoweb page for path, with the footer.
func SubmitWork
crossing ActionSubmitWork sends the link to the work (must start with https://). Only the builder, up to and including the work deadline block.
func UnclaimQuest
crossing ActionUnclaimQuest lets the builder give a Claimed quest back. It opens again, or, if the poster closed it, ends with a refund to the poster.
func GetQuest
ActionGetQuest returns a copy of quest id. It panics on an unknown id.
func GetTotals
ActionGetTotals returns the running totals. Posted == Locked + Paid + Refunded.
2
type QuestView
struct 1type QuestView struct {
2 ID uint64
3 Poster address
4 Title string
5 Details string
6 Reward int64 // ugnot
7 State escrow.State
8 Builder address
9 WorkLink string
10 WorkBlocks int64
11 CreatedAt int64
12 ClaimedAt int64
13 SubmittedAt int64
14 WorkDeadline int64 // last block to submit; 0 unless Claimed or Submitted
15 ReviewDeadline int64 // last block to reject; 0 unless Submitted
16 RejectCount int
17 LastRejectReason string
18 Closing bool // the poster closed it; the reward returns when the builder's turn ends without approval
19 CanRelease bool // ReleaseQuest would succeed now
20 CanClaimPayout bool // the builder could call ClaimPayout now
21}QuestView is a read-only copy of one quest at the current block.
type Totals
struct1type Totals struct {
2 Quests uint64 // quests ever posted
3 OpenQuests int // quests in state Open
4 Posted int64 // ugnot ever locked
5 Locked int64 // ugnot held now for Open, Claimed and Submitted quests
6 Paid int64 // ugnot paid to builders
7 Refunded int64 // ugnot refunded to posters
8 PaidQuests int // quests in state Paid
9}Totals are the board-wide running sums, in ugnot.