proposal
typeproposal is one of the fixed choices set up at Init time.
Value
v0.proposal
voterInfo
typevoterInfo tracks one address's voting rights and delegation state.
Value
v0.voterInfo
chairperson
.uverse.addressPackage-level persistent state.
Value
<zero>
initialized
boolPackage-level persistent state.
Value
false
proposals
[]v0.proposalPackage-level persistent state.
Value
<zero>
voters
*v0.Tree// address string -> \*voterInfo
- OID
- 0b732f…2ef1:54
voters details
errAlreadyInit
*errors.errorString- OID
- 0b732f…2ef1:8
errAlreadyInit details
errNotInit
*errors.errorString- OID
- 0b732f…2ef1:11
errNotInit details
errNotChairperson
*errors.errorString- OID
- 0b732f…2ef1:14
errNotChairperson details
errNoProposals
*errors.errorString- OID
- 0b732f…2ef1:17
errNoProposals details
errInvalidAddr
*errors.errorString- OID
- 0b732f…2ef1:20
errInvalidAddr details
errAlreadyRight
*errors.errorString- OID
- 0b732f…2ef1:23
errAlreadyRight details
errAlreadyVoted
*errors.errorString- OID
- 0b732f…2ef1:26
errAlreadyVoted details
errNoRight
*errors.errorString- OID
- 0b732f…2ef1:29
errNoRight details
errSelfDelegate
*errors.errorString- OID
- 0b732f…2ef1:32
errSelfDelegate details
errDelegateLoop
*errors.errorString- OID
- 0b732f…2ef1:35
errDelegateLoop details
errDelegateNoRight
*errors.errorString- OID
- 0b732f…2ef1:38
errDelegateNoRight details
errBadProposal
*errors.errorString- OID
- 0b732f…2ef1:41
errBadProposal details
init.18
func()- OID
- 0b732f…2ef1:43
init.18 details
requireInit
func()- OID
- 0b732f…2ef1:45
requireInit details
getOrCreateVoter
func(addr .uverse.address) *v0.voterInfo- OID
- 0b732f…2ef1:46
getOrCreateVoter details
Init
func(proposalNamesCSV string)Init configures the ballot exactly once: the caller becomes the chairperson (and is immediately given the right to vote), and proposalNamesCSV — a comma-separated list — seeds the fixed set of proposals. It panics if called twice or with no usable proposal names.
- OID
- 0b732f…2ef1:47
Init details
GiveRightToVote
func(voterAddr string)GiveRightToVote grants voterAddr a voting weight of 1. Only the chairperson may call this, and only for voters who haven't voted yet.
- OID
- 0b732f…2ef1:48
GiveRightToVote details
Delegate
func(toAddr string)Delegate hands the caller's voting weight to toAddr. If toAddr has already voted, the weight is added directly to that proposal's tally; otherwise it accumulates on toAddr's own weight, ready to be cast (or delegated further) later. Mirrors Solidity's delegation-chain-following with a loop guard.
- OID
- 0b732f…2ef1:49
Delegate details
Vote
func(proposalIndex int)Vote casts the caller's full weight for proposals\[proposalIndex].
- OID
- 0b732f…2ef1:50
Vote details
WinningProposal
func() intWinningProposal returns the index of the proposal with the most accumulated weight, breaking ties in favor of the lowest index.
- OID
- 0b732f…2ef1:51
WinningProposal details
WinnerName
func() stringWinnerName returns the name of the current winning proposal, or "" if the ballot hasn't been initialized.
- OID
- 0b732f…2ef1:52
WinnerName details
Render
func(path string) string- OID
- 0b732f…2ef1:53