mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
[Documentation] Add description for VoteTally's methods (#3140)
# Description While methods' names on [`VoteTally`][1] trait might be self-explanatory at first sight, the distinction between `support` and `approval` can be a bit ambiguous for some readers. This PR aims to clarify the distinction and inform about the expected values for every not yet documented method on this trait. # Checklist - [x] My PR includes a detailed description as outlined in the "Description" section above - [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process) of this project (at minimum one label for `T` required) - [x] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works (if applicable) [1]: https://docs.rs/frame-support/latest/frame_support/traits/trait.VoteTally.html --------- Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
07e55006ad
commit
8a8f6f9877
@@ -25,14 +25,24 @@ use sp_runtime::{traits::Member, DispatchError};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub trait VoteTally<Votes, Class> {
|
||||
/// Initializes a new tally.
|
||||
fn new(_: Class) -> Self;
|
||||
/// Returns the number of positive votes for the tally.
|
||||
fn ayes(&self, class: Class) -> Votes;
|
||||
/// Returns the approval ratio (positive to total votes) for the tally, without multipliers
|
||||
/// (e.g. conviction, ranks, etc.).
|
||||
fn support(&self, class: Class) -> Perbill;
|
||||
/// Returns the approval ratio (positive to total votes) for the tally.
|
||||
fn approval(&self, class: Class) -> Perbill;
|
||||
/// Returns an instance of the tally representing a unanimous approval, for benchmarking
|
||||
/// purposes.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn unanimity(class: Class) -> Self;
|
||||
/// Returns an instance of the tally representing a rejecting state, for benchmarking purposes.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn rejection(class: Class) -> Self;
|
||||
/// Returns an instance of the tally given some `approval` and `support`, for benchmarking
|
||||
/// purposes.
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn from_requirements(support: Perbill, approval: Perbill, class: Class) -> Self;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
Reference in New Issue
Block a user