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

v0 state

Back to all declarations

InitialCredits

int64

InitialCredits is the fixed voice-credit budget every address gets to spend on each poll (shared across all of that poll's options).

Value

100

minOptions

untyped bigint

Value

(2 <untyped> bigint)

maxOptions

untyped bigint

Value

(8 <untyped> bigint)

poll

type

Value

v0.poll

voterState

type

voterState is one address's standing inside one poll: how many credits they've spent so far and how many votes that bought them on each option.

Value

v0.voterState

polls

v0.Tree

// poll ID -> \*poll

Open
OID
0168a7…eec0:4
polls details

Inspect ref

voters

v0.Tree

// "\<pollID>:\<addr>" -> \*voterState

Open
OID
0168a7…eec0:6
voters details

Inspect ref

nextID

int

Value

0

voterKey

func(pollID string, addr .uverse.address) string
Open
OID
0168a7…eec0:8
voterKey details

Inspect func

getPoll

func(pollID string) *v0.poll
Open
OID
0168a7…eec0:10
getPoll details

Inspect func

getOrCreateVoter

func(pollID string, addr .uverse.address, numOptions int) *v0.voterState
Open
OID
0168a7…eec0:11
getOrCreateVoter details

Inspect func

square

func(n int64) int64

square is the quadratic-voting cost curve: N votes on one option cost N\*N credits in total.

Open
OID
0168a7…eec0:12
square details

Inspect func

CreatePoll

func(question string, optionsCSV string) string

CreatePoll opens a new poll with the given question and comma-separated options (at least 2, at most 8), returning its ID.

Open
OID
0168a7…eec0:13
CreatePoll details

Inspect func

Vote

func(pollID string, optionIdx int, delta int64) string

Vote adjusts the caller's votes on one option of a poll by delta (positive to buy more, negative to sell some back for a credit refund). The credit cost of holding N votes on an option is N\*N, taken from the caller's fixed per-poll budget of InitialCredits.

Open
OID
0168a7…eec0:14
Vote details

Inspect func

ClosePoll

func(pollID string) string

ClosePoll ends voting on a poll. Only its creator may close it.

Open
OID
0168a7…eec0:15
ClosePoll details

Inspect func

escapeInline

func(s string) string

escapeInline neutralizes markdown-active characters in untrusted text before it's embedded inline in Render output.

Open
OID
0168a7…eec0:16
escapeInline details

Inspect func

leadingOption

func(p *v0.poll) (string, int64)
Open
OID
0168a7…eec0:17
leadingOption details

Inspect func

renderPoll

func(id string) string
Open
OID
0168a7…eec0:19
renderPoll details

Inspect func

renderVoter

func(pollID string, rawAddr string) string
Open
OID
0168a7…eec0:20
renderVoter details

Inspect func

Render

func(path string) string

Render shows the poll board at "", one poll's results at "\<pollID>", or one voter's standing in a poll at "\<pollID>/\<addr>".

Open
OID
0168a7…eec0:21
Render details

Inspect func
InitialCredits : int64 =100
minOptions : untyped bigint =(2 <untyped> bigint)
maxOptions : untyped bigint =(8 <untyped> bigint)
poll : type =v0.poll
voterState : type =v0.voterState
polls : v0.Tree Inspect
voters : v0.Tree Inspect
nextID : int =0
voterKey : func(pollID string, addr .uverse.address) string Inspect
getPoll : func(pollID string) *v0.poll Inspect
getOrCreateVoter : func(pollID string, addr .uverse.address, numOptions int) *v0.voterState Inspect
square : func(n int64) int64 Inspect
CreatePoll : func(question string, optionsCSV string) string Inspect
Vote : func(pollID string, optionIdx int, delta int64) string Inspect
ClosePoll : func(pollID string) string Inspect
escapeInline : func(s string) string Inspect
leadingOption : func(p *v0.poll) (string, int64) Inspect
renderHome : func() string Inspect
renderPoll : func(id string) string Inspect
renderVoter : func(pollID string, rawAddr string) string Inspect
Render : func(path string) string Inspect