mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Per-things trait. (#4904)
* Give perthigns the trait it always deserved.
* Make staking and phragmen work with the new generic per_thing
* Make everything work together 🔨
* a bit of cleanup
* Clean usage
* Bump.
* Fix name
* fix grumbles
* hopefully fix the ui test
* Some grumbles
* revamp traits again
* Better naming again.
This commit is contained in:
@@ -83,7 +83,10 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use sp_runtime::{print, DispatchResult, DispatchError, traits::{Zero, StaticLookup, Convert}};
|
||||
use sp_runtime::{
|
||||
print, DispatchResult, DispatchError, Perbill,
|
||||
traits::{Zero, StaticLookup, Convert},
|
||||
};
|
||||
use frame_support::{
|
||||
decl_storage, decl_event, ensure, decl_module, decl_error, weights::SimpleDispatchInfo,
|
||||
traits::{
|
||||
@@ -637,7 +640,7 @@ impl<T: Trait> Module<T> {
|
||||
let voters_and_votes = <VotesOf<T>>::enumerate()
|
||||
.map(|(v, i)| (v, i))
|
||||
.collect::<Vec<(T::AccountId, Vec<T::AccountId>)>>();
|
||||
let maybe_phragmen_result = sp_phragmen::elect::<_, _, _, T::CurrencyToVote>(
|
||||
let maybe_phragmen_result = sp_phragmen::elect::<_, _, _, T::CurrencyToVote, Perbill>(
|
||||
num_to_elect,
|
||||
0,
|
||||
candidates,
|
||||
@@ -664,7 +667,7 @@ impl<T: Trait> Module<T> {
|
||||
.filter_map(|(m, a)| if a.is_zero() { None } else { Some(m) } )
|
||||
.collect::<Vec<T::AccountId>>();
|
||||
|
||||
let support_map = sp_phragmen::build_support_map::<_, _, _, T::CurrencyToVote>(
|
||||
let support_map = sp_phragmen::build_support_map::<_, _, _, T::CurrencyToVote, Perbill>(
|
||||
&new_set,
|
||||
&phragmen_result.assignments,
|
||||
Self::locked_stake_of,
|
||||
|
||||
Reference in New Issue
Block a user