Struct chain_impl_mockchain::vote::manager::ProposalManager
source · struct ProposalManager {
votes_by_voters: Hamt<DefaultHasher, Identifier, ()>,
options: Options,
tally: IncrementalTally,
action: VoteAction,
}
Fields§
§votes_by_voters: Hamt<DefaultHasher, Identifier, ()>
§options: Options
§tally: IncrementalTally
§action: VoteAction
Implementations§
source§impl ProposalManager
impl ProposalManager
sourcefn new_public(proposal: &Proposal) -> Self
fn new_public(proposal: &Proposal) -> Self
construct a ProposalManager
to track down the votes associated to this
proposal.
the proposal is passed on as parameter so we could add some form of verification in the future about the content of the vote (if possible : ZK is not necessarily allowing this).
sourcefn new_private(
proposal: &Proposal,
election_pk: ElectionPublicKey,
crs: Crs
) -> Self
fn new_private( proposal: &Proposal, election_pk: ElectionPublicKey, crs: Crs ) -> Self
construct a ProposalManager
to track down the votes associated to this
proposal.
the proposal is passed on as parameter so we could add some form of verification in the future about the content of the vote (if possible : ZK is not necessarily allowing this).
sourcepub fn vote(
&self,
identifier: Identifier,
payload: ValidatedPayload,
token_distribution: &TokenDistribution<'_, TokenIdentifier>
) -> Result<Self, VoteError>
pub fn vote( &self, identifier: Identifier, payload: ValidatedPayload, token_distribution: &TokenDistribution<'_, TokenIdentifier> ) -> Result<Self, VoteError>
apply the given vote cast to the proposal
if there is already a vote present for this proposal it will simply replace the previously set one
fn check_already_voted(&self, identifier: &Identifier) -> Result<(), VoteError>
pub fn validate_public_vote( &self, identifier: &Identifier, cast: VoteCast ) -> Result<ValidatedPayload, VoteError>
pub fn validate_private_vote( &self, identifier: &Identifier, cast: VoteCast, crs: &Crs, election_pk: &ElectionPublicKey ) -> Result<ValidatedPayload, VoteError>
pub fn public_tally<F>( &self, token_distribution: &TokenDistribution<'_, TokenIdentifier>, governance: &Governance, f: F ) -> Result<Self, TallyError>where F: FnMut(&VoteAction),
pub fn finalize_private_tally<F>( &self, committee_pks: &[MemberPublicKey], decrypted_proposal: &DecryptedPrivateTallyProposal, governance: &Governance, token_distribution: &TokenDistribution<'_, TokenIdentifier>, f: F ) -> Result<Self, TallyError>where F: FnMut(&VoteAction),
fn check( &self, total: Stake, governance: &Governance, results: &TallyResult ) -> bool
fn check_governance_criteria( &self, total: Stake, acceptance: &GovernanceAcceptanceCriteria, results: &TallyResult ) -> bool
Trait Implementations§
source§impl Clone for ProposalManager
impl Clone for ProposalManager
source§fn clone(&self) -> ProposalManager
fn clone(&self) -> ProposalManager
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl PartialEq<ProposalManager> for ProposalManager
impl PartialEq<ProposalManager> for ProposalManager
source§fn eq(&self, other: &ProposalManager) -> bool
fn eq(&self, other: &ProposalManager) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ProposalManager
impl StructuralEq for ProposalManager
impl StructuralPartialEq for ProposalManager
Auto Trait Implementations§
impl RefUnwindSafe for ProposalManager
impl Send for ProposalManager
impl Sync for ProposalManager
impl Unpin for ProposalManager
impl UnwindSafe for ProposalManager
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more