xdao.gno
1.71 Kb · 44 lines
1package xdao
2
3import (
4 "chain/runtime/unsafe"
5
6 "gno.land/p/moul/udao/v0"
7)
8
9// DAO is a whitelist system that implements the udao.DAO interface.
10// It can allow a trusted list of addresses to share the administration of realms that are designed to be managed by "DAOs".
11// It's not a DAO per say. But makes sense to be used to bootstrap a realm until the DAO can replace itself with a really decnetralized autonomous organization. Asan inception.
12// It's also useful for people who manages multiple keys, like on different computers so they can simulte being a single entity while managing several addresses.
13type WhitelistDAO struct {
14 admins []address // for the sake of simplicity and because this simple DAO implementation isn't designed to scale, we just keep a simple slice
15}
16
17// check that DAO implements the udao.DAO interface.
18var _ udao.DAO = (*WhitelistDAO)(nil)
19
20func NewWhitelistDAO() *WhitelistDAO {
21 caller := unsafe.PreviousRealm().Address()
22 return &WhitelistDAO{
23 admins: []address{caller},
24 }
25}
26
27// udao.DAO methods
28//
29
30func (d *WhitelistDAO) Propose(prop udao.Proposal) (uint64, error) { panic("not implemented") }
31
32func (d WhitelistDAO) GetProposalStatus(id uint64) (udao.ProposalStatus, error) {
33 panic("not implemented")
34}
35func (d *WhitelistDAO) Execute(id uint64) error { panic("not implemented") }
36func (d WhitelistDAO) GetProposal(id uint64) (udao.Proposal, error) { panic("not implemented") }
37
38// other methods
39//
40
41func (d *WhitelistDAO) AddAdmin(addr address) { panic("not implemented") }
42func (d *WhitelistDAO) DelAdmin(addr address) { panic("not implemented") }
43func (d WhitelistDAO) ListAdmins() []address { return d.admins[:] }
44func (d WhitelistDAO) Render(path string) string { return "TODO" }