ValidatorsDecisionState
Class: ValidatorsDecisionState
Properties overview
- abstainVotes: UInt32 = UInt32; ↗
- alreadyVoted: Field = Field; ↗
- decision: ValidatorsDecision = ValidatorsDecision; ↗
- noVotes: UInt32 = UInt32; ↗
- yesVotes: UInt32 = UInt32; ↗
Methods overview
Defined in: packages/upgradable/src/validators.ts:280
Represents the state of a validators decision during the voting process.
Extends
- {
abstainVotes
:UInt32
;
alreadyVoted
:Field
;
decision
:ValidatorsDecision
;
noVotes
:UInt32
;
yesVotes
:UInt32
;
}
Constructors
new ValidatorsDecisionState()
new ValidatorsDecisionState(value: {
abstainVotes: UInt32;
alreadyVoted: Field;
decision: ValidatorsDecision;
noVotes: UInt32;
yesVotes: UInt32;
}): ValidatorsDecisionState
Defined in: node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:103
Parameters
value
abstainVotes
UInt32
= UInt32
Number of votes of abstention
alreadyVoted
Field
= Field
Indexed Merkle Map root of the validators who have voted
decision
ValidatorsDecision
= ValidatorsDecision
The validators' decision
noVotes
UInt32
= UInt32
Number of votes against the decision
yesVotes
UInt32
= UInt32
Number of votes in favor of the decision
Returns
Inherited from
Struct({
/ The validators' decision /
decision: ValidatorsDecision,
/ Indexed Merkle Map root of the validators who have voted /
alreadyVoted: Field,
/ Number of votes in favor of the decision /
yesVotes: UInt32,
/ Number of votes against the decision /
noVotes: UInt32,
/ Number of votes of abstention /
abstainVotes: UInt32,
}).constructor
Properties
abstainVotes
abstainVotes: UInt32 = UInt32;
Defined in: packages/upgradable/src/validators.ts:290
Number of votes of abstention
Inherited from
Struct({
/ The validators' decision /
decision: ValidatorsDecision,
/ Indexed Merkle Map root of the validators who have voted /
alreadyVoted: Field,
/ Number of votes in favor of the decision /
yesVotes: UInt32,
/ Number of votes against the decision /
noVotes: UInt32,
/ Number of votes of abstention /
abstainVotes: UInt32,
}).abstainVotes
alreadyVoted
alreadyVoted: Field = Field;
Defined in: packages/upgradable/src/validators.ts:284
Indexed Merkle Map root of the validators who have voted
Inherited from
Struct({
/ The validators' decision /
decision: ValidatorsDecision,
/ Indexed Merkle Map root of the validators who have voted /
alreadyVoted: Field,
/ Number of votes in favor of the decision /
yesVotes: UInt32,
/ Number of votes against the decision /
noVotes: UInt32,
/ Number of votes of abstention /
abstainVotes: UInt32,
}).alreadyVoted
decision
decision: ValidatorsDecision = ValidatorsDecision;
Defined in: packages/upgradable/src/validators.ts:282
The validators' decision
Inherited from
Struct({
/ The validators' decision /
decision: ValidatorsDecision,
/ Indexed Merkle Map root of the validators who have voted /
alreadyVoted: Field,
/ Number of votes in favor of the decision /
yesVotes: UInt32,
/ Number of votes against the decision /
noVotes: UInt32,
/ Number of votes of abstention /
abstainVotes: UInt32,
}).decision
noVotes
noVotes: UInt32 = UInt32;
Defined in: packages/upgradable/src/validators.ts:288
Number of votes against the decision
Inherited from
Struct({
/ The validators' decision /
decision: ValidatorsDecision,
/ Indexed Merkle Map root of the validators who have voted /
alreadyVoted: Field,
/ Number of votes in favor of the decision /
yesVotes: UInt32,
/ Number of votes against the decision /
noVotes: UInt32,
/ Number of votes of abstention /
abstainVotes: UInt32,
}).noVotes
yesVotes
yesVotes: UInt32 = UInt32;
Defined in: packages/upgradable/src/validators.ts:286
Number of votes in favor of the decision
Inherited from
Struct({
/ The validators' decision /
decision: ValidatorsDecision,
/ Indexed Merkle Map root of the validators who have voted /
alreadyVoted: Field,
/ Number of votes in favor of the decision /
yesVotes: UInt32,
/ Number of votes against the decision /
noVotes: UInt32,
/ Number of votes of abstention /
abstainVotes: UInt32,
}).yesVotes
Methods
vote()
vote(
validatorNullifier: Nullifier,
validatorsList: ValidatorsList,
votedList: ValidatorsList,
yes: Bool,
no: Bool,
abstain: Bool,
signature: Signature): ValidatorsDecisionState
Defined in: packages/upgradable/src/validators.ts:312
Records a vote
Parameters
validatorNullifier
Nullifier
The nullifier of the validator.
validatorsList
The ValidatorsList containing authorized validators.
votedList
The ValidatorsList tracking who has already voted.
yes
Bool
Whether this is a "yes" vote.
no
Bool
Whether this is a "no" vote.
abstain
Bool
Whether this is an "abstain" vote.
signature
Signature
The signature of the validator.
Returns
A new ValidatorsDecisionState
reflecting the vote.
assertEquals()
static assertEquals(a: ValidatorsDecisionState, b: ValidatorsDecisionState): void
Defined in: packages/upgradable/src/validators.ts:368
Asserts that two ValidatorsDecisionState
instances are equal.
Parameters
a
First ValidatorsDecisionState
instance.
b
Second ValidatorsDecisionState
instance.
Returns
void
startVoting()
static startVoting(decision: ValidatorsDecision): ValidatorsDecisionState
Defined in: packages/upgradable/src/validators.ts:292
Parameters
decision
Returns
Updated 10 days ago