uri.gno
0.85 Kb · 37 lines
1package commondao
2
3import (
4 "chain/runtime"
5 "strings"
6
7 "gno.land/p/nt/ufmt/v0"
8)
9
10func currentRealmPath() string {
11 return strings.TrimPrefix(string(realmLink), runtime.ChainDomain())
12}
13
14func daoURL(daoID uint64) string {
15 path := currentRealmPath()
16 return ufmt.Sprintf("%s:%d", path, daoID)
17}
18
19func settingsURL(daoID uint64) string {
20 path := currentRealmPath()
21 return ufmt.Sprintf("%s:%d/settings", path, daoID)
22}
23
24func daoProposalsURL(daoID uint64) string {
25 path := currentRealmPath()
26 return ufmt.Sprintf("%s:%d/proposals", path, daoID)
27}
28
29func proposalURL(daoID, proposalID uint64) string {
30 path := currentRealmPath()
31 return ufmt.Sprintf("%s:%d/proposals/%d", path, daoID, proposalID)
32}
33
34func voteURL(daoID, proposalID uint64, addr address) string {
35 path := currentRealmPath()
36 return ufmt.Sprintf("%s:%d/proposals/%d/vote/%s", path, daoID, proposalID, addr)
37}