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

governor state

Back to all declarations

votingPeriod

int64

votingPeriod is the number of blocks a proposal stays open for voting.

Value

100

VoteAgainst

untyped bigint

Vote support values.

Value

(0 <untyped> bigint)

VoteFor

untyped bigint

Vote support values.

Value

(1 <untyped> bigint)

VoteAbstain

untyped bigint

Vote support values.

Value

(2 <untyped> bigint)

StateActive

untyped string

Proposal state values.

Value

"Active"

StateSucceeded

untyped string

Proposal state values.

Value

"Succeeded"

StateDefeated

untyped string

Proposal state values.

Value

"Defeated"

StateExecuted

untyped string

Proposal state values.

Value

"Executed"

Proposal

type

Proposal is a single governance proposal.

Value

governor.Proposal

proposals

*v0.Tree

// id (zero-padded string) -> \*Proposal

Open
OID
053687…bb70:4
proposals details

Inspect pointer

nextID

int64

Value

1

totalCount

int64

Value

0

Propose

func(description string) int64

Propose opens a new proposal and returns its id. The snapshot height and deadline are recorded from the current chain height.

Open
OID
053687…bb70:8
Propose details

Inspect func

CastVote

func(id int64, support int)

CastVote records one vote for the caller on proposal id. support is 0=against, 1=for, 2=abstain. One address may vote at most once per proposal, and voting is only allowed while the proposal is Active.

Open
OID
053687…bb70:10
CastVote details

Inspect func

Execute

func(id int64)

Execute marks a Succeeded proposal as executed. It panics unless the proposal has reached the Succeeded state.

Open
OID
053687…bb70:11
Execute details

Inspect func

State

func(id int64) string

State returns the current lifecycle state of proposal id.

Open
OID
053687…bb70:12
State details

Inspect func

computeState

func(p *governor.Proposal, h int64) string

computeState is the pure state machine: it decides the state of p at chain height h. Kept free of globals so it is unit-testable.

Open
OID
053687…bb70:13
computeState details

Inspect func

mustGet

func(id int64) *governor.Proposal
Open
OID
053687…bb70:14
mustGet details

Inspect func

idKey

func(id int64) string

idKey returns a zero-padded, lexicographically-sortable key for an id so the avl tree iterates proposals in numeric order.

Open
OID
053687…bb70:15
idKey details

Inspect func

bar

func(value int64, total int64, width int) string

bar renders a proportional ▓░ progress bar of fixed width.

Open
OID
053687…bb70:16
bar details

Inspect func

Render

func(path string) string

Render lists all proposals with their tallies and states as Markdown.

Open
OID
053687…bb70:17
Render details

Inspect func
votingPeriod : int64 =100
VoteAgainst : untyped bigint =(0 <untyped> bigint)
VoteFor : untyped bigint =(1 <untyped> bigint)
VoteAbstain : untyped bigint =(2 <untyped> bigint)
StateActive : untyped string ="Active"
StateSucceeded : untyped string ="Succeeded"
StateDefeated : untyped string ="Defeated"
StateExecuted : untyped string ="Executed"
Proposal : type =governor.Proposal
proposals : *v0.Tree Inspect
nextID : int64 =1
totalCount : int64 =0
Propose : func(description string) int64 Inspect
CastVote : func(id int64, support int) Inspect
Execute : func(id int64) Inspect
State : func(id int64) string Inspect
computeState : func(p *governor.Proposal, h int64) string Inspect
mustGet : func(id int64) *governor.Proposal Inspect
idKey : func(id int64) string Inspect
bar : func(value int64, total int64, width int) string Inspect
Render : func(path string) string Inspect