Replace T::AccountId with <T::Lookup as StaticLookup>::Source (#11670)

* initial

* update

* update

* update

* cargo fmt

* update

* update benchmarks

* AccountIdLookupOf<T>

* cargo fmt

* fix conflits

* cargo fmt

* update

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Doordashcon
2022-08-18 10:30:46 +01:00
committed by GitHub
parent 511e5c9651
commit d46f6f0d34
50 changed files with 465 additions and 309 deletions
+8 -11
View File
@@ -40,10 +40,10 @@ mod impls;
pub use impls::*;
use crate::{
slashing, weights::WeightInfo, ActiveEraInfo, BalanceOf, EraPayout, EraRewardPoints, Exposure,
Forcing, MaxUnlockingChunks, NegativeImbalanceOf, Nominations, PositiveImbalanceOf, Releases,
RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk,
ValidatorPrefs,
slashing, weights::WeightInfo, AccountIdLookupOf, ActiveEraInfo, BalanceOf, EraPayout,
EraRewardPoints, Exposure, Forcing, MaxUnlockingChunks, NegativeImbalanceOf, Nominations,
PositiveImbalanceOf, Releases, RewardDestination, SessionInterface, StakingLedger,
UnappliedSlash, UnlockChunk, ValidatorPrefs,
};
const STAKING_ID: LockIdentifier = *b"staking ";
@@ -768,7 +768,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::bond())]
pub fn bond(
origin: OriginFor<T>,
controller: <T::Lookup as StaticLookup>::Source,
controller: AccountIdLookupOf<T>,
#[pallet::compact] value: BalanceOf<T>,
payee: RewardDestination<T::AccountId>,
) -> DispatchResult {
@@ -1055,7 +1055,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::nominate(targets.len() as u32))]
pub fn nominate(
origin: OriginFor<T>,
targets: Vec<<T::Lookup as StaticLookup>::Source>,
targets: Vec<AccountIdLookupOf<T>>,
) -> DispatchResult {
let controller = ensure_signed(origin)?;
@@ -1175,7 +1175,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::set_controller())]
pub fn set_controller(
origin: OriginFor<T>,
controller: <T::Lookup as StaticLookup>::Source,
controller: AccountIdLookupOf<T>,
) -> DispatchResult {
let stash = ensure_signed(origin)?;
let old_controller = Self::bonded(&stash).ok_or(Error::<T>::NotStash)?;
@@ -1521,10 +1521,7 @@ pub mod pallet {
/// Note: Making this call only makes sense if you first set the validator preferences to
/// block any further nominations.
#[pallet::weight(T::WeightInfo::kick(who.len() as u32))]
pub fn kick(
origin: OriginFor<T>,
who: Vec<<T::Lookup as StaticLookup>::Source>,
) -> DispatchResult {
pub fn kick(origin: OriginFor<T>, who: Vec<AccountIdLookupOf<T>>) -> DispatchResult {
let controller = ensure_signed(origin)?;
let ledger = Self::ledger(&controller).ok_or(Error::<T>::NotController)?;
let stash = &ledger.stash;