pub struct GovernanceSystem { /* private fields */ }Implementations§
Source§impl GovernanceSystem
impl GovernanceSystem
pub fn new(quorum_threshold: f64, approval_threshold: f64) -> Self
pub fn create_proposal( &mut self, title: String, description: String, proposer: String, proposal_type: ProposalType, voting_duration: Duration, ) -> String
pub fn vote( &mut self, voter: String, proposal_id: &str, choice: VoteChoice, stake_weight: f64, ) -> Result<(), GovernanceError>
pub fn tally(&self, proposal_id: &str, total_stake: f64) -> Option<VoteTally>
pub fn finalize( &mut self, proposal_id: &str, total_stake: f64, ) -> Result<ProposalStatus, GovernanceError>
pub fn get_proposal(&self, proposal_id: &str) -> Option<&Proposal>
pub fn active_proposals(&self) -> Vec<&Proposal>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GovernanceSystem
impl RefUnwindSafe for GovernanceSystem
impl Send for GovernanceSystem
impl Sync for GovernanceSystem
impl Unpin for GovernanceSystem
impl UnsafeUnpin for GovernanceSystem
impl UnwindSafe for GovernanceSystem
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