mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Refactor CurrencyToVote (#6896)
* Refactor CurrencyToVote to avoid calls to total_issuance. * Update frame/support/src/traits.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Some grumbles * Fix last grumbles. * Fix comment * Final fix Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ use sp_runtime::{
|
||||
curve::PiecewiseLinear,
|
||||
impl_opaque_keys,
|
||||
testing::{Header, TestXt, UintAuthorityId},
|
||||
traits::{Convert, IdentityLookup, OpaqueKeys, SaturatedConversion},
|
||||
traits::{IdentityLookup, OpaqueKeys},
|
||||
DigestItem, Perbill,
|
||||
};
|
||||
use sp_staking::SessionIndex;
|
||||
@@ -198,23 +198,9 @@ parameter_types! {
|
||||
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
|
||||
}
|
||||
|
||||
pub struct CurrencyToVoteHandler;
|
||||
|
||||
impl Convert<u128, u128> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u128 {
|
||||
x
|
||||
}
|
||||
}
|
||||
|
||||
impl Convert<u128, u64> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u64 {
|
||||
x.saturated_into()
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_staking::Trait for Test {
|
||||
type RewardRemainder = ();
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
|
||||
type Event = TestEvent;
|
||||
type Currency = Balances;
|
||||
type Slash = ();
|
||||
|
||||
Reference in New Issue
Block a user