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

render.gno

1.27 Kb · 42 lines
 1package common
 2
 3import (
 4	"chain"
 5	"strings"
 6
 7	"gno.land/p/moul/md/v0"
 8	"gno.land/p/moul/mdtable/v0"
 9	"gno.land/p/nt/ufmt/v0"
10	"gno.land/r/gnoswap/common"
11	"gno.land/r/nt/grc20reg/v0"
12)
13
14func (c *commonV1) Render(path string) string {
15	if path != "" {
16		return "404\n"
17	}
18
19	implementation := common.GetImplementationPackagePath()
20	table := mdtable.Table{
21		Headers: []string{"Field", "Value"},
22		Rows: [][]string{
23			{"Realm address", md.InlineCode(chain.PackageAddress("gno.land/r/gnoswap/common").String())},
24			{"Active implementation", md.Link(implementation, strings.TrimPrefix(implementation, "gno.land"))},
25			{"Token registry", md.Link("gno.land/r/nt/grc20reg/v0", "/r/nt/grc20reg/v0")},
26			{"Registry entries (network-wide)", ufmt.Sprintf("%d", grc20reg.GetRegistry().Size())},
27		},
28	}
29
30	out := md.H1("Gnoswap Common") + "\n"
31	out += md.H2("Registry configuration") + "\n"
32	out += table.String() + "\n"
33	out += md.Paragraph(
34		"Token operations resolve a registered " + md.InlineCode("realm-path.SYMBOL") + " key. " +
35			"The registry count includes tokens outside Gnoswap; it is not a trading whitelist.",
36	)
37	out += md.Paragraph(
38		"Native coins are not accepted by token operations. " +
39			"Query balances and allowances per token; amounts use that token's base units.",
40	)
41	return out
42}