user.gno

1.69 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: "Samouraï Crew",
20		Bio: "Samouraï Coop is a decentralized agency mixing film makers, designers, hackers, developers into a single cooperative company. Providing high quality services since 2016 to decentralized ecosystems, communities & international major Web3 companies, the coop company developed an agency side, a production company, and a lab with a research focus on distributed protocols, a future of cooperative governances.\n\nSamouraï Crew is members of this cooperative company who're experimenting, designing, building, hacking future of decentralized autonomous human organizations.\nThis crew is also building Zenao.io and organizers of HyperHacktive Festival.\nhttps://www.samourai.world",
21		AvatarURI: "ipfs://bafybeib62oinb3ee5vztgu43bwvzejammxplod6koxqsbmyipyjpqdsqfm",
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}