Skip to content Search Apps Documentation Source Content 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.

reputation source realm

Package reputation is Guildhall's record of completed work.

Overview

Package reputation is Guildhall's record of completed work.

Every record says that a piece of work was paid for, who did it, who vouched for it, how much it paid and where the work lives (a PR, a realm path, a proposal). Records can only be written by allowlisted writer realms, the Guildhall bounty escrow first among them, and only at the moment escrowed funds are released. Each record also keeps the address whose signed transaction released the funds.

Scores are derived from those records with the rules in gno.land/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/guildhall/trust: a record is worth more when the people who approved it are themselves trusted. Any realm can consume the result with a single import:

Example
1import "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/guildhall/reputation"
2
3func Vote(cur realm, ...) {
4	reputation.AssertScore(cur.Previous().Address(), 300)
5	...
6}

Constants 1

const BountiesPath

1const BountiesPath = "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/guildhall/bounties"
source

BountiesPath is the escrow realm allowed to write records at launch.

Functions 27

func AddRecord

crossing Action
1func AddRecord(cur realm, worker, poster address, reviewers []address, shareBps, amount int64, denom, title, link, ref string, arbitrated bool) uint64
source

AddRecord stores a piece of paid work and credits the worker. It may only be called by an allowlisted writer realm, at the moment it releases funds.

worker was paid amount of denom for work funded by poster and approved by reviewers. shareBps is the fraction of the milestone the worker received (10000 unless a dispute split it). title, link and ref describe the work: link points at the PR, realm path or proposal, and ref identifies the work within the writer realm (for bounties, "<id>/<milestone>").

func AddSeed

crossing Action
1func AddSeed(cur realm, addr address)
source

AddSeed marks addr as a seed reviewer with full trust.

func AddWriter

crossing Action
1func AddWriter(cur realm, pkgPath string)
source

AddWriter allows another realm to write records.

func AssertScore

Action
1func AssertScore(addr address, min int64)
source

AssertScore panics unless addr's score is at least min. It is the one-line gate for realms that want reputation-weighted access.

func CompletedCount

Action
1func CompletedCount(addr address) int
source

CompletedCount returns how many paid records addr has as a worker.

func Earned

Action
1func Earned(addr address, denom string) int64
source

Earned returns the total addr has been paid in denom through records.

func HasScore

Action
1func HasScore(addr address, min int64) bool
source

HasScore reports whether addr's score is at least min.

func IsSeed

Action
1func IsSeed(addr address) bool
source

IsSeed reports whether addr is a seed reviewer.

func IsWriter

Action
1func IsWriter(pkgPath string) bool
source

IsWriter reports whether pkgPath may write records.

func Level

Action
1func Level(addr address) string
source

Level returns a display name for addr's score band.

func Params

Action
1func Params() trust.Params
source

Params returns the scoring parameters in force.

func Rank

Action
1func Rank(addr address) int
source

Rank returns addr's 1-based leaderboard position, or 0 if unranked.

func RemoveSeed

crossing Action
1func RemoveSeed(cur realm, addr address)
source

RemoveSeed revokes addr's seed status. Existing records keep the points they were awarded; only future reviews are affected.

func RemoveWriter

crossing Action
1func RemoveWriter(cur realm, pkgPath string)
source

RemoveWriter revokes a realm's right to write records.

func Render

1func Render(path string) string
source

Render serves the reputation pages:

Example
1""            leaderboard and latest records
2u/<address>   contributor profile
3record/<id>   a single record
4records       every record, newest first (?page=N)
5seeds         seed reviewers
6about         scoring rules

func RenounceAdmin

crossing Action
1func RenounceAdmin(cur realm)
source

RenounceAdmin gives up the admin key for good. Nothing can curate reputation afterwards: seeds, writers and parameters are frozen and no record can be voided. Prefer TransferAdmin unless that is the intent.

func ReviewCount

Action
1func ReviewCount(addr address) int
source

ReviewCount returns how many records addr has vouched for.

func Score

Action
1func Score(addr address) int64
source

Score returns addr's current reputation score.

func SetParams

crossing Action
1func SetParams(cur realm, base, trustThreshold, trustFloorBps, selfFundedFactorBps int64)
source

SetParams changes the scoring rules for future records.

func TransferAdmin

crossing Action
1func TransferAdmin(cur realm, newAdmin address)
source

TransferAdmin hands the admin key to another address, such as a multisig.

func VoidRecord

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

VoidRecord cancels a fraudulent record and removes its points from the worker. Trust the worker lent to others while holding those points is not unwound; voiding is for correcting abuse, not rewriting history.

func GetRecord

Action
1func GetRecord(id uint64) (Record, bool)
source

GetRecord returns a copy of the record with the given id.

func RecordsOf

Action
1func RecordsOf(addr address, offset, limit int) []Record
source

RecordsOf returns up to limit of addr's work records, newest first, skipping the first offset.

func ReviewsOf

Action
1func ReviewsOf(addr address, offset, limit int) []Record
source

ReviewsOf returns up to limit of the records addr vouched for, newest first.

func Top

Action
1func Top(n int) []Standing
source

Top returns the n highest scores, highest first. Ties are ordered by address.

Types 3

type Profile

struct
1type Profile struct {
2	Addr    address
3	Score   int64
4	Records []uint64
5	Reviews []uint64
6	First   time.Time
7	Last    time.Time
8	earned  *avl.Tree // denom -> int64
9}
source

Profile aggregates a contributor's records.

type Record

struct
 1type Record struct {
 2	ID            uint64
 3	Worker        address
 4	Poster        address
 5	Reviewers     []address
 6	ReviewerTrust []int64
 7	Points        int64
 8	ShareBps      int64
 9	Amount        int64
10	Denom         string
11	Title         string
12	Link          string
13	Ref           string
14	Source        string
15	SignedBy      address
16	Arbitrated    bool
17	Height        int64
18	At            time.Time
19	Voided        bool
20	VoidReason    string
21}
source

Record is a stored, immutable account of paid work. Only Voided can change, and only by the Guildhall admin.

type Standing

struct
1type Standing struct {
2	Addr  address
3	Score int64
4}
source

Standing is a leaderboard entry.

Dependencies

Source Files 4