Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

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 ...

Overview

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).

Constants 5

const Denom, MinReward, MaxPageSize

1const (
2	// Denom is the only coin a quest reward can be paid in.
3	Denom = "ugnot"
4	// MinReward is the smallest reward a quest can lock: 1 GNOT.
5	MinReward int64 = 1_000_000
6	// MaxPageSize caps how many ids one list call returns.
7	MaxPageSize = 50
8)
source

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)
source

Panic messages for the realm's own checks. Escrow rule violations panic with the escrow error's text (prefix "escrow: ").

const ApproxBlockMillis

1const ApproxBlockMillis = 3500
source

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

1const PageSize = 20
source

PageSize is the number of quests per list page.

const SourceRepo

1const SourceRepo = "https://github.com/elangrr/questmaster"
source

SourceRepo is where the source code is published, shown in the footer of every page.

Functions 19

func AllQuestIDs

Action
1func AllQuestIDs(offset, limit int) []uint64
source

AllQuestIDs lists ids of all quests, newest first.

func ApproveWork

crossing Action
1func ApproveWork(cur realm, id uint64)
source

ApproveWork accepts the submitted work and pays the reward to the builder. Only the poster.

func CancelQuest

crossing Action
1func CancelQuest(cur realm, id uint64)
source

CancelQuest 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 Action
1func ClaimPayout(cur realm, id uint64)
source

ClaimPayout 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 Action
1func ClaimQuest(cur realm, id uint64)
source

ClaimQuest takes an Open quest. The poster cannot claim their own quest.

func OpenQuestIDs

Action
1func OpenQuestIDs(offset, limit int) []uint64
source

OpenQuestIDs lists ids of Open quests, newest first. offset skips that many; at most MaxPageSize ids are returned whatever limit is.

func PaidQuestIDs

Action
1func PaidQuestIDs(offset, limit int) []uint64
source

PaidQuestIDs lists ids of Paid quests, newest first (by quest id).

func PostQuest

crossing Action
1func PostQuest(cur realm, title, details string, workBlocks int64) uint64
source

PostQuest 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

Action
1func QuestIDsByBuilder(addr address, offset, limit int) []uint64
source

QuestIDsByBuilder 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

Action
1func QuestIDsByPoster(addr address, offset, limit int) []uint64
source

QuestIDsByPoster lists ids of quests posted by addr, newest first.

func RejectWork

crossing Action
1func RejectWork(cur realm, id uint64, reason string)
source

RejectWork 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 Action
1func ReleaseQuest(cur realm, id uint64)
source

ReleaseQuest 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

1func Render(path string) string
source

Render returns the gnoweb page for path, with the footer.

func SubmitWork

crossing Action
1func SubmitWork(cur realm, id uint64, link string)
source

SubmitWork sends the link to the work (must start with https://). Only the builder, up to and including the work deadline block.

func UnclaimQuest

crossing Action
1func UnclaimQuest(cur realm, id uint64)
source

UnclaimQuest 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

Action
1func GetQuest(id uint64) QuestView
source

GetQuest returns a copy of quest id. It panics on an unknown id.

func GetTotals

Action
1func GetTotals() Totals
source

GetTotals returns the running totals. Posted == Locked + Paid + Refunded.

Types 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}
source

QuestView is a read-only copy of one quest at the current block.

type Totals

struct
1type 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}
source

Totals are the board-wide running sums, in ugnot.

Dependencies

Source Files 8