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

ballot/v0 package

Overview

Package ballot is a Gno port of the classic Solidity "Ballot" voting contract from the Solidity docs. A chairperson seeds a fixed list of proposals and grants specific addresses the right to vote; each voter can either cast a direct vote or delegate their weight to another voter, and delegation follows a chain so a delegate who later delegates further still carries every accumulated weight. The winning proposal is whichever has the most accumulated weight at query time.

Function

WinningProposal

func WinningProposal() int

WinningProposal returns the index of the proposal with the most accumulated weight, breaking ties in favor of the lowest index.

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/ballot/v0.WinningProposal()"

Result