pub type TallyOf<T, I = ()> = Tally<BalanceOf<T, I>, <T as Config<I>>::MaxTurnout>;
Aliased Type§
struct TallyOf<T, I = ()> {
pub ayes: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance,
pub nays: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance,
pub support: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance,
/* private fields */
}
Fields§
§ayes: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance
The number of aye votes, expressed in terms of post-conviction lock-vote.
nays: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance
The number of nay votes, expressed in terms of post-conviction lock-vote.
support: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance
The basic number of aye votes, expressed pre-conviction.
Implementations
Source§impl<Votes: Clone + Default + PartialEq + Eq + Debug + Copy + AtLeast32BitUnsigned + TypeInfo + Codec, Total: Get<Votes>> Tally<Votes, Total>
impl<Votes: Clone + Default + PartialEq + Eq + Debug + Copy + AtLeast32BitUnsigned + TypeInfo + Codec, Total: Get<Votes>> Tally<Votes, Total>
pub fn from_parts( ayes_with_conviction: Votes, nays_with_conviction: Votes, support: Votes, ) -> Self
Sourcepub fn add(&mut self, vote: AccountVote<Votes>) -> Option<()>
pub fn add(&mut self, vote: AccountVote<Votes>) -> Option<()>
Add an account’s vote into the tally.
Sourcepub fn remove(&mut self, vote: AccountVote<Votes>) -> Option<()>
pub fn remove(&mut self, vote: AccountVote<Votes>) -> Option<()>
Remove an account’s vote from the tally.
Sourcepub fn increase(&mut self, approve: bool, delegations: Delegations<Votes>)
pub fn increase(&mut self, approve: bool, delegations: Delegations<Votes>)
Increment some amount of votes.
Sourcepub fn reduce(&mut self, approve: bool, delegations: Delegations<Votes>)
pub fn reduce(&mut self, approve: bool, delegations: Delegations<Votes>)
Decrement some amount of votes.
Trait Implementations
Source§impl<Votes: Clone + PartialEq + Eq + Debug + TypeInfo + Codec, Total> Clone for Tally<Votes, Total>
impl<Votes: Clone + PartialEq + Eq + Debug + TypeInfo + Codec, Total> Clone for Tally<Votes, Total>
Source§impl<Votes: Clone + PartialEq + Eq + Debug + TypeInfo + Codec, Total> Debug for Tally<Votes, Total>
impl<Votes: Clone + PartialEq + Eq + Debug + TypeInfo + Codec, Total> Debug for Tally<Votes, Total>
Source§impl<Votes, Total> Decode for Tally<Votes, Total>where
Votes: Decode + Clone + PartialEq + Eq + Debug + TypeInfo + Codec,
PhantomData<Total>: Decode,
impl<Votes, Total> Decode for Tally<Votes, Total>where
Votes: Decode + Clone + PartialEq + Eq + Debug + TypeInfo + Codec,
PhantomData<Total>: Decode,
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
Source§impl<Votes, Total> Encode for Tally<Votes, Total>where
Votes: Encode + Clone + PartialEq + Eq + Debug + TypeInfo + Codec,
PhantomData<Total>: Encode,
impl<Votes, Total> Encode for Tally<Votes, Total>where
Votes: Encode + Clone + PartialEq + Eq + Debug + TypeInfo + Codec,
PhantomData<Total>: Encode,
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<Votes, Total> MaxEncodedLen for Tally<Votes, Total>
impl<Votes, Total> MaxEncodedLen for Tally<Votes, Total>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl<Votes: Clone + PartialEq + Eq + Debug + TypeInfo + Codec, Total> PartialEq for Tally<Votes, Total>
impl<Votes: Clone + PartialEq + Eq + Debug + TypeInfo + Codec, Total> PartialEq for Tally<Votes, Total>
Source§impl<Votes, Total> TypeInfo for Tally<Votes, Total>where
Votes: TypeInfo + 'static + Clone + PartialEq + Eq + Debug + TypeInfo + Codec,
PhantomData<Total>: TypeInfo + 'static,
Total: 'static,
impl<Votes, Total> TypeInfo for Tally<Votes, Total>where
Votes: TypeInfo + 'static + Clone + PartialEq + Eq + Debug + TypeInfo + Codec,
PhantomData<Total>: TypeInfo + 'static,
Total: 'static,
Source§impl<Votes: Clone + Default + PartialEq + Eq + Debug + Copy + AtLeast32BitUnsigned + TypeInfo + Codec, Total: Get<Votes>, Class> VoteTally<Votes, Class> for Tally<Votes, Total>
impl<Votes: Clone + Default + PartialEq + Eq + Debug + Copy + AtLeast32BitUnsigned + TypeInfo + Codec, Total: Get<Votes>, Class> VoteTally<Votes, Class> for Tally<Votes, Total>
Source§fn support(&self, _: Class) -> Perbill
fn support(&self, _: Class) -> Perbill
Returns the approval ratio (positive to total votes) for the tally, without multipliers
(e.g. conviction, ranks, etc.).
Source§fn approval(&self, _: Class) -> Perbill
fn approval(&self, _: Class) -> Perbill
Returns the approval ratio (positive to total votes) for the tally.
Source§fn unanimity(_: Class) -> Self
fn unanimity(_: Class) -> Self
Returns an instance of the tally representing a unanimous approval, for benchmarking
purposes.
Source§fn rejection(_: Class) -> Self
fn rejection(_: Class) -> Self
Returns an instance of the tally representing a rejecting state, for benchmarking purposes.
Source§fn from_requirements(support: Perbill, approval: Perbill, _: Class) -> Self
fn from_requirements(support: Perbill, approval: Perbill, _: Class) -> Self
Returns an instance of the tally given some
approval
and support
, for benchmarking
purposes.