user.gno
1.30 Kb ยท 49 lines
1package user
2
3import (
4 "gno.land/p/zenao/users"
5 "gno.land/r/demo/profile"
6 "gno.land/p/zenao/daokit"
7 "gno.land/p/zenao/daocond"
8)
9
10var (
11 DAO daokit.DAO
12 localDAO daokit.DAO
13
14 user *users.User // XXX: needed for backward compatibility with frontend queries
15)
16
17func init() {
18 user = users.NewUser(&users.Config{
19 Name: "Yohann_G",
20 Bio: "Yohann Grignou has been immersed in the world of extreme sports since his early work in filmmaking. Initially focused on directing short films and commercials, his encounters and experiences gradually allowed him to discover the world and led him to document what was happening around him.",
21 AvatarURI: "ipfs://bafybeic4quwzetld26etwc44ghwgi367u55mot3apyddqdosdujogoctbe",
22 GetProfileString: profile.GetStringField,
23 SetProfileString: profile.SetStringField,
24 ZenaoAdminAddr: "g1djrkw9tf4px658j85cc6fhsvm50uf9s0g6kfsm",
25 CrossFn: crossFn,
26 SetImplemFn: setImplem,
27 PrivateVarName: "user",
28 })
29}
30
31func Vote(_ realm, proposalID uint64, vote daocond.Vote) {
32 localDAO.Vote(proposalID, vote)
33}
34
35func Execute(_ realm, proposalID uint64) {
36 localDAO.Execute(proposalID)
37}
38
39func Render(path string) string {
40 return localDAO.Render(path)
41}
42
43func crossFn(_ realm, cb func()) {
44 cb()
45}
46
47func setImplem(newLocalDAO daokit.DAO, newDAO daokit.DAO) {
48 localDAO, DAO = newLocalDAO, newDAO
49}