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(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl Schemaifier for Threshold
impl Schemaifier for Threshold
fn visit_schema(visitor: &mut SchemaVisitor) -> DefinitionReference
fn id() -> Identifier
impl StructuralPartialEq for Threshold
Auto Trait Implementations§
impl Freeze for Threshold
impl RefUnwindSafe for Threshold
impl Send for Threshold
impl Sync for Threshold
impl Unpin for Threshold
impl UnwindSafe for Threshold
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more