Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

binding.gno

1.00 Kb · 23 lines
 1package sharedpoll
 2
 3import (
 4	"gno.land/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/remixlab/core/v1"
 5	"gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/remixlab/sharedmembers"
 6)
 7
 8// sharedPath is the reviewed shared membership realm this app is bound to.
 9const sharedPath = "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/remixlab/sharedmembers"
10
11// sharedReader adapts the shared membership realm to core.MembershipReader.
12// It is read-only: it can look roles up and take snapshots, nothing else.
13type sharedReader struct{}
14
15func (sharedReader) RoleOf(addr address) core.Role { return sharedmembers.RoleOf(addr) }
16func (sharedReader) Size() int                     { return sharedmembers.Size() }
17func (sharedReader) Snapshot(minRole core.Role, max int) ([]address, bool) {
18	return sharedmembers.Snapshot(minRole, max)
19}
20
21// electorate is the membership source for poll electorates. Tests replace
22// it with a local fake; production code never reassigns it.
23var electorate core.MembershipReader = sharedReader{}