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

votingbooth source realm

Constants 1

Functions 7

func CreatePoll

Action
1func CreatePoll(creator, question string, options []string, durationBlocks int64, oneVoteOnly bool) string
source

Types 3

type Booth

struct
1type Booth struct {
2	admin         string
3	polls         map[string]*Poll
4	nextSeq       int64
5	currentHeight int64
6}
source

Methods on Booth

func ClosePoll

method on Booth
1func (b *Booth) ClosePoll(caller, pollID string) bool
source

func CreatePoll

method on Booth
1func (b *Booth) CreatePoll(creator, question string, options []string, durationBlocks int64, oneVoteOnly bool) (string, bool)
source

func GetPoll

method on Booth
1func (b *Booth) GetPoll(id string) (*Poll, bool)
source

func Tick

method on Booth
1func (b *Booth) Tick(height int64)
source

func Vote

method on Booth
1func (b *Booth) Vote(voter, pollID string, optionIdx int) bool
source

func Winner

method on Booth
1func (b *Booth) Winner(pollID string) (string, bool)
source

type Poll

struct
 1type Poll struct {
 2	ID          string
 3	Creator     string
 4	Question    string
 5	Options     []string
 6	Tally       []int64
 7	EndHeight   int64
 8	Status      PollStatus
 9	OneVoteOnly bool
10	voted       map[string]int // voter -> option index (for revote tracking)
11	hasVoted    map[string]bool
12}
source

Source Files 2