event.gno

2.68 Kb ยท 79 lines
 1package event
 2
 3import (
 4	zenaov1 "gno.land/p/zenao/zenao/v1"
 5	"gno.land/p/zenao/events"
 6	"gno.land/p/zenao/basedao"
 7	"gno.land/p/zenao/daokit"
 8	"gno.land/p/zenao/daocond"
 9	"gno.land/r/demo/profile"
10	"gno.land/r/zenao/eventreg"
11	"gno.land/r/zenao/social_feed"
12)
13
14var (
15	DAO      daokit.DAO
16	localDAO daokit.DAO
17
18	event  *events.Event // XXX: needed for backward compatibility with frontend queries
19	feedId string        // XXX: workaround for "unexpected zero object id" issue
20)
21
22func init() {
23	// XXX: workaround for "unexpected zero object id" issue
24	feedId = social_feed.NewFeed(cross, "main", false, feedAuth)
25}
26
27func init() {
28	conf := events.Config{
29		Organizers: []string{"gno.land/r/zenao/users/u26"},
30		Gatekeepers: []string{},
31		Title: "Gno Contributors Call (Demo event)",
32		Description: "# Contributor Technical Discussions (demo event)\n\n*To goal of this meeting is to have structured, in depth technical discussions between the contributors and the gno.land core team.*\n\nIf you have a demo or a discussion to propose, simply put it on the list, along with the proposer name. The proposer is expected to hold the demo, or to set the stage for the discussion.\n\nNominate the topics in HackMD to add it to the meeting agenda:\n- Demos (submitted beforehand)\n- Technical discussions (submitted beforehand)\n- Technical discussions (ad-hoc)\n\n---\nNote:\nThis event is for demo on the today's gno contributor call.\nComplementary discussions on the dedicated Signal group.",
33		ImageURI: "ipfs://bafkreic5rmvpjo74xtli4zwdiy5kmmlbhucz7dz2t6cf3itrp2ifhw7vgi",
34		StartDate: 1746036000,
35		EndDate: 1746049500,
36		Capacity: 50,
37		Discoverable: true,
38		GetProfileString: profile.GetStringField,
39		SetProfileString: profile.SetStringField,
40		ZenaoAdminAddr: "g1djrkw9tf4px658j85cc6fhsvm50uf9s0g6kfsm",
41		Location: &zenaov1.EventLocation{
42			Address: &zenaov1.AddressVirtual{
43				Uri: "https://meet.google.com/omw-duip-jmi",
44			},
45		},
46		ParticipationPubkey: "",
47		CrossFn: crossFn,
48		SetImplemFn: setImplem,
49		FeedId: feedId,
50		PrivateVarName: "event",
51	}
52	event = events.NewEvent(&conf)
53	eventreg.Register(cross, func() *zenaov1.EventInfo { return event.Info() })
54}
55
56func Vote(_ realm, proposalID uint64, vote daocond.Vote) {
57	localDAO.Vote(proposalID, vote)
58}
59
60func Execute(_ realm, proposalID uint64) {
61	localDAO.Execute(proposalID)
62}
63
64func Render(path string) string {
65	return localDAO.Render(path)
66}
67
68func feedAuth() (string, bool) {
69	caller := event.DAOPrivate.CallerID() // XXX: this should be upgradable
70	return caller, basedao.MustGetMembersViewExtension(localDAO).IsMember(caller)
71}
72
73func crossFn(_ realm, cb func()) {
74	cb()
75}
76
77func setImplem(newLocalDAO daokit.DAO, newDAO daokit.DAO) {
78	localDAO, DAO = newLocalDAO, newDAO
79}