pub struct GovernanceProposal {
pub proposal_id: String,
pub title: String,
pub description: String,
pub proposer: Address,
pub proposal_type: ProposalType,
pub voting_start: Timestamp,
pub voting_end: Timestamp,
pub status: ProposalStatus,
pub votes_for: u128,
pub votes_against: u128,
pub total_voting_power: u128,
pub execution_data: Option<Vec<u8>>,
}Expand description
Governance proposal
Fields§
§proposal_id: StringProposal ID
title: StringProposal title
description: StringProposal description
proposer: AddressProposer address
proposal_type: ProposalTypeProposal type
voting_start: TimestampVoting start time
voting_end: TimestampVoting end time
status: ProposalStatusCurrent status
votes_for: u128Votes in favor
votes_against: u128Votes against
total_voting_power: u128Total voting power
execution_data: Option<Vec<u8>>Execution data (if applicable)
Implementations§
Source§impl GovernanceProposal
impl GovernanceProposal
Sourcepub fn new(
title: String,
description: String,
proposer: Address,
proposal_type: ProposalType,
voting_duration_ms: i64,
) -> Self
pub fn new( title: String, description: String, proposer: Address, proposal_type: ProposalType, voting_duration_ms: i64, ) -> Self
Creates a new governance proposal
Sourcepub fn is_voting_open(&self) -> bool
pub fn is_voting_open(&self) -> bool
Checks if voting is still open
Sourcepub fn approval_percentage(&self) -> u32
pub fn approval_percentage(&self) -> u32
Returns the current approval percentage (basis points)
Trait Implementations§
Source§impl Clone for GovernanceProposal
impl Clone for GovernanceProposal
Source§fn clone(&self) -> GovernanceProposal
fn clone(&self) -> GovernanceProposal
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GovernanceProposal
impl Debug for GovernanceProposal
Source§impl<'de> Deserialize<'de> for GovernanceProposal
impl<'de> Deserialize<'de> for GovernanceProposal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for GovernanceProposal
Source§impl PartialEq for GovernanceProposal
impl PartialEq for GovernanceProposal
Source§fn eq(&self, other: &GovernanceProposal) -> bool
fn eq(&self, other: &GovernanceProposal) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for GovernanceProposal
impl Serialize for GovernanceProposal
impl StructuralPartialEq for GovernanceProposal
Auto Trait Implementations§
impl Freeze for GovernanceProposal
impl RefUnwindSafe for GovernanceProposal
impl Send for GovernanceProposal
impl Sync for GovernanceProposal
impl Unpin for GovernanceProposal
impl UnsafeUnpin for GovernanceProposal
impl UnwindSafe for GovernanceProposal
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