Poll
typePoll is a single question with its options and per-address vote tracking.
Value
v0.Poll
polls
[]*v0.Poll// index i holds the poll with ID i
Value
<zero>
nextID
intValue
0
CreatePoll
func(question string, options string) intCreatePoll registers a new poll. options is a comma-separated list; blank entries are dropped. Returns the new poll's id. Crossing function: an EOA invokes it via MsgCall; another realm via polls.CreatePoll(cross, q, opts).
- OID
- 09dd98…1f0b:5
CreatePoll details
Vote
func(pollID int, optionIndex int)Vote casts one vote for optionIndex on poll pollID. Each caller address may vote at most once per poll. Crossing function.
- OID
- 09dd98…1f0b:7
Vote details
parseOptions
func(options string) []stringparseOptions splits a comma-separated option string, trimming whitespace and dropping empties. Pure logic — no realm state.
- OID
- 09dd98…1f0b:8
parseOptions details
getPoll
func(id int) *v0.PollgetPoll returns the poll with the given id or panics if it does not exist.
- OID
- 09dd98…1f0b:9
getPoll details
PollCount
func() intPollCount returns the number of polls created so far (read-only helper).
- OID
- 09dd98…1f0b:10
PollCount details
barWidth
untyped bigintValue
(20 <untyped> bigint)
bar
func(count int, total int) stringbar renders a proportional ▓░ bar of fixed width for count out of total.
- OID
- 09dd98…1f0b:11
bar details
percent
func(count int, total int) intpercent returns the integer percentage of count out of total.
- OID
- 09dd98…1f0b:12
percent details
total
func(tallies []int) inttotal sums a tally slice.
- OID
- 09dd98…1f0b:13
total details
renderPoll
func(b *strings.Builder, p *v0.Poll)renderPoll writes one poll's Markdown block into b.
- OID
- 09dd98…1f0b:14
renderPoll details
Render
func(path string) stringRender produces the Markdown page for gnoweb. It is NOT a crossing function. - "" -> index of all polls - "\<id>" -> a single poll by id
- OID
- 09dd98…1f0b:15