Trait frame_support::traits::VoteTally
source · pub trait VoteTally<Votes, Class> {
// Required methods
fn new(_: Class) -> Self;
fn ayes(&self, class: Class) -> Votes;
fn support(&self, class: Class) -> Perbill;
fn approval(&self, class: Class) -> Perbill;
fn unanimity(class: Class) -> Self;
fn rejection(class: Class) -> Self;
fn from_requirements(
support: Perbill,
approval: Perbill,
class: Class
) -> Self;
fn setup(class: Class, granularity: Perbill);
}
Required Methods§
fn new(_: Class) -> Self
fn ayes(&self, class: Class) -> Votes
fn support(&self, class: Class) -> Perbill
fn approval(&self, class: Class) -> Perbill
fn unanimity(class: Class) -> Self
fn rejection(class: Class) -> Self
fn from_requirements(support: Perbill, approval: Perbill, class: Class) -> Self
sourcefn setup(class: Class, granularity: Perbill)
fn setup(class: Class, granularity: Perbill)
A function that should be called before any use of the runtime-benchmarks
gated functions
of the VoteTally
trait.
Should be used to set up any needed state in a Pallet which implements VoteTally
so that
benchmarks that execute will complete successfully. class
can be used to set up a
particular class of voters, and granularity
is used to determine the weight of one vote
relative to total unanimity.
For example, in the case where there are a number of unique voters, and each voter has equal
voting weight, a granularity of Perbill::from_rational(1, 1000)
should create 1_000
users.