mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
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:
@@ -165,7 +165,7 @@ use frame_support::{
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
traits::{Bounded, Dispatchable, Hash, Saturating, Zero},
|
||||
traits::{Bounded, Dispatchable, Hash, Saturating, StaticLookup, Zero},
|
||||
ArithmeticError, DispatchError, DispatchResult, RuntimeDebug,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
@@ -206,6 +206,7 @@ type BalanceOf<T> =
|
||||
type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<
|
||||
<T as frame_system::Config>::AccountId,
|
||||
>>::NegativeImbalance;
|
||||
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
|
||||
|
||||
#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
|
||||
pub enum PreimageStatus<AccountId, Balance, BlockNumber> {
|
||||
@@ -944,11 +945,12 @@ pub mod pallet {
|
||||
#[pallet::weight(T::WeightInfo::delegate(T::MaxVotes::get()))]
|
||||
pub fn delegate(
|
||||
origin: OriginFor<T>,
|
||||
to: T::AccountId,
|
||||
to: AccountIdLookupOf<T>,
|
||||
conviction: Conviction,
|
||||
balance: BalanceOf<T>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
let who = ensure_signed(origin)?;
|
||||
let to = T::Lookup::lookup(to)?;
|
||||
let votes = Self::try_delegate(who, to, conviction, balance)?;
|
||||
|
||||
Ok(Some(T::WeightInfo::delegate(votes)).into())
|
||||
@@ -1127,8 +1129,9 @@ pub mod pallet {
|
||||
T::WeightInfo::unlock_set(T::MaxVotes::get())
|
||||
.max(T::WeightInfo::unlock_remove(T::MaxVotes::get()))
|
||||
)]
|
||||
pub fn unlock(origin: OriginFor<T>, target: T::AccountId) -> DispatchResult {
|
||||
pub fn unlock(origin: OriginFor<T>, target: AccountIdLookupOf<T>) -> DispatchResult {
|
||||
ensure_signed(origin)?;
|
||||
let target = T::Lookup::lookup(target)?;
|
||||
Self::update_lock(&target);
|
||||
Ok(())
|
||||
}
|
||||
@@ -1184,10 +1187,11 @@ pub mod pallet {
|
||||
#[pallet::weight(T::WeightInfo::remove_other_vote(T::MaxVotes::get()))]
|
||||
pub fn remove_other_vote(
|
||||
origin: OriginFor<T>,
|
||||
target: T::AccountId,
|
||||
target: AccountIdLookupOf<T>,
|
||||
index: ReferendumIndex,
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
let target = T::Lookup::lookup(target)?;
|
||||
let scope = if target == who { UnvoteScope::Any } else { UnvoteScope::OnlyExpired };
|
||||
Self::try_remove_vote(&target, index, scope)?;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user