pub enum Threshold {
AbsoluteCount {
weight: u64,
},
AbsolutePercentage {
percentage: Decimal,
},
ThresholdQuorum {
threshold: Decimal,
quorum: Decimal,
},
}
Expand description
This defines the different ways tallies can happen.
The total_weight used for calculating success as well as the weights of each
individual voter used in tallying should be snapshotted at the beginning of
the block at which the proposal starts (this is likely the responsibility of a
correct cw4 implementation).
See also ThresholdResponse
in the cw3 spec.
Variants§
AbsoluteCount
Declares that a fixed weight of Yes votes is needed to pass.
See ThresholdResponse.AbsoluteCount
in the cw3 spec for details.
AbsolutePercentage
Declares a percentage of the total weight that must cast Yes votes in order for
a proposal to pass.
See ThresholdResponse.AbsolutePercentage
in the cw3 spec for details.
ThresholdQuorum
Declares a quorum
of the total votes that must participate in the election in order
for the vote to be considered at all.
See ThresholdResponse.ThresholdQuorum
in the cw3 spec for details.
Implementations§
source§impl Threshold
impl Threshold
sourcepub fn validate(&self, total_weight: u64) -> Result<(), ThresholdError>
pub fn validate(&self, total_weight: u64) -> Result<(), ThresholdError>
returns error if this is an unreachable value, given a total weight of all members in the group
sourcepub fn to_response(&self, total_weight: u64) -> ThresholdResponse
pub fn to_response(&self, total_weight: u64) -> ThresholdResponse
Creates a response from the saved data, just missing the total_weight info
Trait Implementations§
source§impl<'de> Deserialize<'de> for Threshold
impl<'de> Deserialize<'de> for Threshold
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 Threshold
impl JsonSchema for Threshold
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(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more