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.

adminparams.gno

4.02 Kb · 107 lines
  1package kourt
  2import (
  3	"strconv"
  4	"strings"
  5)
  6func adminAddr() address {
  7	if globalDAO != nil {
  8		return globalDAO.admin
  9	}
 10	return directoryAdmin
 11}
 12func purgeThreshold() int {
 13	if globalDAO != nil {
 14		return globalDAO.purgeM
 15	}
 16	return daoBootstrapM
 17}
 18func daoSeats() int {
 19	if globalDAO != nil {
 20		return globalDAO.n
 21	}
 22	return daoBootstrapN
 23}
 24func AdminParams() string {
 25	l := ladderDefault
 26	r := creditRatesDefault
 27	hosts := MediaHosts()
 28	exact, suffix := hosts, ""
 29	if i := strings.Index(hosts, "|"); i >= 0 {
 30		exact, suffix = hosts[:i], hosts[i+1:]
 31	}
 32	n := func(v int64) string { return strconv.FormatInt(v, 10) }
 33	return "admin:" + adminAddr().String() +
 34		";creationBurn:" + n(courtCreationBurn) +
 35		";assocBond:" + n(assocBondDefault) +
 36		";purgeM:" + strconv.Itoa(purgeThreshold()) +
 37		";t1:" + n(l.t1Bps) +
 38		";t2:" + n(l.t2Bps) +
 39		";t3:" + n(l.t3Bps) +
 40		";entry:" + n(l.postsEntry) +
 41		";l2:" + n(l.postsT2) +
 42		";l3:" + n(l.postsT3()) +
 43		";flag:" + n(r.flag) +
 44		";dispute:" + n(r.dispute) +
 45		";authorHigh:" + n(r.authorHigh) +
 46		";conviction:" + n(r.conviction) +
 47		";unadjudicated:" + n(r.unadjudicated) +
 48		";domain:" + siteDomain +
 49		";mediaExact:" + exact +
 50		";mediaSuffix:" + suffix
 51}
 52const adminParamsPath = "admin-params"
 53func renderAdminParams() string {
 54	l := ladderDefault
 55	r := creditRatesDefault
 56	n := func(v int64) string { return strconv.FormatInt(v, 10) }
 57	var b strings.Builder
 58	b.WriteString("# Realm parameters\n\n")
 59	b.WriteString("Everything the global DAO admin can set, and what it is set " +
 60		"to now. A court's moderators set their own court's bond, ladder and " +
 61		"standing rates; those are on the court's page, not here.\n\n")
 62	b.WriteString("Admin: `" + adminAddr().String() + "`\n\n")
 63	b.WriteString("| Setting | Now | What it does | Set with |\n")
 64	b.WriteString("|---|---|---|---|\n")
 65	b.WriteString("| Court creation burn | " + ugnotAmt(courtCreationBurn) +
 66		" GNOT | The minimum a new court costs to open. The whole payment is " +
 67		"burned. 0 turns it off, and off is the shipped default. | " +
 68		"`SetCourtCreationBurn` |\n")
 69	b.WriteString("| Association bond | " + ccAmt(assocBondDefault) +
 70		" CC | What a stranger posts to attach an edge, in courts that set no " +
 71		"override. | `SetAssociationBondDefault` |\n")
 72	b.WriteString("| Purge threshold | " + strconv.Itoa(purgeThreshold()) + " of " +
 73		strconv.Itoa(daoSeats()) + " | How many global moderators must agree to purge. | " +
 74		"`SetPurgeThreshold` |\n")
 75	b.WriteString("| Posting ladder | " + n(l.t1Bps) + "/" + n(l.t2Bps) + "/" +
 76		n(l.t3Bps) + " bps at " + n(l.postsEntry) + "/" + n(l.postsT2) + "/" +
 77		n(l.postsT3()) + " posts | The default rungs a court inherits: the share " +
 78		"earned at each tier and the post counts that reach them. | " +
 79		"`SetLadderDefault` |\n")
 80	b.WriteString("| Standing rates | flag " + n(r.flag) + " (inert), dispute " +
 81		n(r.dispute) + ", author " + n(r.authorHigh) + ", conviction " +
 82		n(r.conviction) + ", unadjudicated " + n(r.unadjudicated) +
 83		" bps | The default credit each act earns toward standing. Policing " +
 84		"ranks above authorship, which ranks above staking. The flag rate is " +
 85		"still settable and still bounds what authorship may be set to, but no " +
 86		"path credits it since the quality lane was removed. | " +
 87		"`SetCreditRatesDefault` |\n")
 88	dom := siteDomain
 89	if dom == "" {
 90		dom = "_none_"
 91	}
 92	b.WriteString("| Site domain | " + dom + " | The website this realm belongs " +
 93		"to. Also allow-lists that domain for images without listing it below. | " +
 94		"`SetSiteDomain` |\n")
 95	hosts := MediaHosts()
 96	if hosts == "|" {
 97		hosts = "_none_"
 98	}
 99	b.WriteString("| Media hosts | " + hosts + " | Where images may be loaded " +
100		"from: exact hosts before the bar, suffixes after it. | " +
101		"`SetMediaHosts` |\n")
102	b.WriteString("\nBurned to date, across every court and every creation: **" +
103		ugnotAmt(BurnedGNOT()) + " GNOT**, held at `" + BurnSink().String() +
104		"` — an address derived from a sub-realm identity that is never created, " +
105		"so no key to it exists and nothing can ever be spent from it.\n")
106	return b.String()
107}