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

Init

func Init(cur realm, 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.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/ballot/v0" -func "Init" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/ballot/v0" -func "Init" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx