Struct chain_impl_mockchain::certificate::VotePlan
source · pub struct VotePlan {
vote_start: BlockDate,
vote_end: BlockDate,
committee_end: BlockDate,
proposals: Proposals,
payload_type: PayloadType,
committee_public_keys: Vec<MemberPublicKey>,
voting_token: TokenIdentifier,
}
Expand description
a vote plan for the voting system
A vote plan defines what is being voted, for how long and how long is the committee supposed to reveal the results.
Fields§
§vote_start: BlockDate
the vote start validity
vote_end: BlockDate
the duration within which it is possible to vote for one of the proposals of this voting plan.
committee_end: BlockDate
the committee duration is the time allocated to the committee to open the ballots and publish the results on chain
proposals: Proposals
the proposals to vote for
payload_type: PayloadType
vote payload type
committee_public_keys: Vec<MemberPublicKey>
encrypting votes public keys
voting_token: TokenIdentifier
voting token used for weigthing the votes for any proposal in this voteplan
Implementations§
source§impl VotePlan
impl VotePlan
pub fn new( vote_start: BlockDate, vote_end: BlockDate, committee_end: BlockDate, proposals: Proposals, payload_type: PayloadType, committee_public_keys: Vec<MemberPublicKey>, voting_token: TokenIdentifier ) -> Self
pub fn check_governance(&self, governance: &Governance) -> bool
pub fn is_governance(&self) -> bool
pub fn vote_start(&self) -> BlockDate
pub fn vote_end(&self) -> BlockDate
pub fn committee_start(&self) -> BlockDate
pub fn committee_end(&self) -> BlockDate
pub fn proposals_mut(&mut self) -> &mut Proposals
pub fn payload_type(&self) -> PayloadType
pub fn committee_public_keys(&self) -> &[MemberPublicKey]
pub fn voting_token(&self) -> &TokenIdentifier
pub fn vote_started(&self, date: BlockDate) -> bool
pub fn vote_finished(&self, date: BlockDate) -> bool
sourcepub fn can_vote(&self, date: BlockDate) -> bool
pub fn can_vote(&self, date: BlockDate) -> bool
tells if it is possible to vote at the given date
[vote_start..vote_end[
: from the start date (included) to
the end (not included).
pub fn committee_started(&self, date: BlockDate) -> bool
pub fn committee_finished(&self, date: BlockDate) -> bool
sourcepub fn committee_time(&self, date: BlockDate) -> bool
pub fn committee_time(&self, date: BlockDate) -> bool
tells if it is possible to do the committee operations at the given date
[vote_end..committee_end[
from the end of the vote date (included) to the
end of the committee (not included).
pub fn serialize_in(&self, bb: ByteBuilder<Self>) -> ByteBuilder<Self>
pub fn serialize(&self) -> ByteArray<Self>
sourcepub fn to_id(&self) -> VotePlanId
pub fn to_id(&self) -> VotePlanId
build the identifier of the vote plan
this is not a very efficient function so it is better not to call it in tight loop