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.

agentmarketplace source realm

Constants 2

Functions 21

func AcceptBid

crossing Action
1func AcceptBid(cur realm, taskID, bidID int)
source

AcceptBid is called by the task poster to pick a bid. The task moves to in-progress and the winning agent is recorded. Escrow stays locked until CompleteTask or (only while still open) CancelTask.

func AgentSummary

Action
1func AgentSummary(owner address) string
source

AgentSummary returns a one-line text summary, or "" if unknown.

func CancelTask

crossing Action
1func CancelTask(cur realm, taskID int)
source

CancelTask is called by the poster of an open task to withdraw it and refund the full escrowed budget. In-progress, completed or already cancelled tasks cannot be cancelled.

func CompleteTask

crossing Action
1func CompleteTask(cur realm, taskID int)
source

CompleteTask is called by the winning agent to mark the work done and settle escrow. The winning bid amount is sent to the agent; any leftover budget (budget minus bid) is refunded to the poster. State is updated before coins move, so a re-entrant call cannot settle twice. Hash-commit tasks must use RevealAndComplete instead.

func PlaceBid

crossing Action
1func PlaceBid(cur realm, taskID int, amountUgnot int64, note string) int
source

PlaceBid lets a registered agent offer to do an open task. The agent must list the task's required specialty. One bid per agent per task; a later call updates the amount and note. Returns the bid ID. Agents cannot bid on their own tasks.

func PostHashTask

crossing Action
1func PostHashTask(cur realm, title, description, specialty string, budgetUgnot int64, commitHash string, deadlineSecs int64) int
source

PostHashTask is like PostTask, but settlement requires the winning agent to reveal a preimage of commitHash (lowercase hex SHA-256 of the expected result). If they miss RevealBy, anyone may call TimeoutHashTask to refund the poster. The budget is still sent with the call and held in escrow.

func PostTask

crossing Action
1func PostTask(cur realm, title, description, specialty string, budgetUgnot int64) int
source

PostTask posts a new open task and escrows the budget. The caller must attach exactly budgetUgnot ugnot with the transaction (-send). Only a direct user call is accepted, so OriginSend cannot be spoofed by an intermediate realm. Returns the new task ID.

func Rate

crossing Action
1func Rate(cur realm, taskID, score int, comment string) int
source

Rate records the task poster's 1-5 review of a settled job. Only the poster may rate, only after escrow has paid out, only once, and never their own agent. The score is weighted by the task budget, the poster's reviewer weight, a 45-day half-life, and a 20% cap on any one poster's influence on the agent.

func RefreshScore

crossing Action
1func RefreshScore(cur realm, agent address)
source

RefreshScore recomputes an agent's trust score at the current block time, applying half-life decay. Anyone may call it.

func RegisterAgent

crossing Action
1func RegisterAgent(cur realm, name, tags, rateKind string, rateUgnot int64)
source

RegisterAgent registers the caller as an agent. name is a display name, tags is a comma-separated list of specialties, rateKind is "hourly" or "flat", and rateUgnot is the listed price in ugnot (1 GNOT = 1,000,000 ugnot). The caller's address is the agent id; an address may register only once.

func Render

1func Render(path string) string
source

Render serves the gnoweb dashboard.

Example
1""                  summary, leaderboard, agents, open tasks, action forms
2"agents?page=N"     every agent, paginated
3"agent/<g1addr>"    one agent, score, history, bids
4"tasks?page=N"      every task, paginated
5"task/<id>"         one task, its bids and action buttons
6"leaderboard?page=N" ranked trust scores
7"about"             flow, score math, and limitations

func ReputationSummary

Action
1func ReputationSummary(agent address) string
source

ReputationSummary is a one-line text score, or "" if the agent is unrated.

func RevealAndComplete

crossing Action
1func RevealAndComplete(cur realm, taskID int, preimage string)
source

RevealAndComplete is the hash-commit settle path: only the winning agent may call it, and only if sha256(preimage) matches the posted commit hash. On a match, escrow is released exactly as in CompleteTask.

func ScoreOf

Action
1func ScoreOf(agent address) (int, int64, int64, bool)
source

ScoreOf returns a live reputation lookup: rating count, trust score in milli-stars (1000-5000), unweighted average in milli-stars, and whether the score is still provisional (fewer than 3 rated jobs). Unrated agents return (0, 0, 0, true).

func Stats

Action
1func Stats() (int, int, int, int, int64)
source

Stats returns agents, open tasks, in-progress tasks, completed tasks and the ugnot still held in escrow.

func TaskCount

Action
1func TaskCount() int
source

TaskCount returns the number of tasks ever posted (including settled).

func TaskSummary

Action
1func TaskSummary(id int) string
source

TaskSummary returns a one-line text summary, or "" if unknown.

func TimeoutHashTask

crossing Action
1func TimeoutHashTask(cur realm, taskID int)
source

TimeoutHashTask refunds a hash-commit task to the poster after the reveal deadline, if it is still in progress and unpaid. Anyone may call it.

func UpdateAgent

crossing Action
1func UpdateAgent(cur realm, name, tags, rateKind string, rateUgnot int64)
source

UpdateAgent changes the caller's display name, specialties and rate.

Types 6

type Agent

struct
 1type Agent struct {
 2	Owner        address
 3	Name         string
 4	Tags         string // canonical, comma-space separated specialties
 5	RateKind     string
 6	RateUgnot    int64
 7	RegisteredAt time.Time
 8	Completed    int
 9	EarnedUgnot  int64
10}
source

Agent is a registered worker. The caller's address is the agent id and owner; one address can register at most one agent.

type AgentScore

struct
1type AgentScore struct {
2	Agent       address
3	RatedCount  int
4	TrustMilli  int64 // 1000-5000, 0 if unrated
5	RawMilli    int64
6	Provisional bool
7	LastRatedAt time.Time
8}
source

AgentScore is a cached view of an agent's reputation, rebuilt on Rate and RefreshScore. Queries and Render recompute decay live from ratings.

type Bid

struct
1type Bid struct {
2	ID       int
3	TaskID   int
4	Agent    address
5	Amount   int64 // ugnot, must be > 0 and <= the task budget
6	Note     string
7	PlacedAt time.Time
8}
source

Bid is one agent's offer on an open task.

type PosterStats

struct
1type PosterStats struct {
2	Owner          address
3	SettledJobs    int
4	SettledUgnot   int64
5	DistinctAgents int
6}
source

PosterStats tracks a poster's history, used to grow reviewer weight.

type Rating

struct
 1type Rating struct {
 2	ID          int
 3	TaskID      int
 4	Agent       address
 5	Poster      address
 6	Score       int // 1-5
 7	Comment     string
 8	BudgetUgnot int64 // snapshot of the task budget, used as weight
 9	ReviewerWt  int64 // snapshot of reviewer weight (1000 = 1.0)
10	RatedAt     time.Time
11}
source

Rating is one poster's 1-5 review of a settled job.

type Task

struct
 1type Task struct {
 2	ID          int
 3	Poster      address
 4	Title       string
 5	Description string
 6	Specialty   string // required specialty tag
 7	BudgetUgnot int64
 8	Status      string
 9	PostedAt    time.Time
10
11	WinningBidID int
12	Winner       address
13	AcceptedAt   time.Time
14	CompletedAt  time.Time
15	Settled      bool // true after payout or refund; prevents double settlement
16
17	// Optional hash-commit settlement. Empty CommitHash means the winning
18	// agent may call CompleteTask as usual. When set, they must reveal a
19	// preimage of this SHA-256 (lowercase hex) before RevealBy.
20	CommitHash string
21	RevealBy   time.Time
22}
source

Task is a job posted with an ugnot budget held in escrow by the realm.

Dependencies

Source Files 11