Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

render.gno

0.90 Kb · 33 lines
 1package governance
 2
 3import (
 4	"strings"
 5
 6	"gno.land/p/moul/md/v0"
 7	"gno.land/p/moul/mdtable/v0"
 8	ufmt "gno.land/p/nt/ufmt/v0"
 9	"gno.land/r/gnoswap/gov/governance"
10)
11
12func (g *governanceV1) Render(path string) string {
13	if path != "" {
14		return "404\n"
15	}
16
17	implementation := governance.GetImplementationPackagePath()
18
19	out := md.H1("Gnoswap Governance")
20	out += md.H2("Governance configuration")
21	configurationTable := mdtable.Table{
22		Headers: []string{"Field", "Value"},
23		Rows: [][]string{
24			{"Active implementation", md.Link(implementation, strings.TrimPrefix(implementation, "gno.land"))},
25			{"Latest configuration version", ufmt.Sprintf("%d", governance.GetLatestConfigVersion())},
26			{"Current proposal ID", ufmt.Sprintf("%d", governance.GetCurrentProposalID())},
27			{"Maximum smoothing period", ufmt.Sprintf("%d", governance.GetMaxSmoothingPeriod())},
28		},
29	}
30	out += configurationTable.String()
31
32	return out
33}