diff --git a/substrate/frame/support/src/traits/voting.rs b/substrate/frame/support/src/traits/voting.rs index f5c9e285ef3a..f18d4ed4e90b 100644 --- a/substrate/frame/support/src/traits/voting.rs +++ b/substrate/frame/support/src/traits/voting.rs @@ -25,14 +25,24 @@ use sp_runtime::{traits::Member, DispatchError}; use sp_std::prelude::*; pub trait VoteTally { + /// 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")]