pub enum PercentageThreshold {
Majority {},
Percent(Decimal),
}Expand description
A percentage of voting power that must vote yes for a proposal to pass. An example of why this is needed:
If a user specifies a 60% passing threshold, and there are 10
voters they likely expect that proposal to pass when there are 6
yes votes. This implies that the condition for passing should be
vote_weights >= total_votes * threshold.
With this in mind, how should a user specify that they would like proposals to pass if the majority of voters choose yes? Selecting a 50% passing threshold with those rules doesn’t properly cover that case as 5 voters voting yes out of 10 would pass the proposal. Selecting 50.0001% or or some variation of that also does not work as a very small yes vote which technically makes the majority yes may not reach that threshold.
To handle these cases we provide both a majority and percent
option for all percentages. If majority is selected passing will
be determined by yes > total_votes * 0.5. If percent is selected
passing is determined by yes >= total_votes * percent.
In both of these cases a proposal with only abstain votes must fail. This requires a special case passing logic.
Variants§
Majority
The majority of voters must vote yes for the proposal to pass.
Percent(Decimal)
A percentage of voting power >= percent must vote yes for the proposal to pass.
Trait Implementations§
Source§impl Clone for PercentageThreshold
impl Clone for PercentageThreshold
Source§fn clone(&self) -> PercentageThreshold
fn clone(&self) -> PercentageThreshold
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PercentageThreshold
impl Debug for PercentageThreshold
Source§impl<'de> Deserialize<'de> for PercentageThreshold
impl<'de> Deserialize<'de> for PercentageThreshold
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>,
Source§impl JsonSchema for PercentageThreshold
impl JsonSchema for PercentageThreshold
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more