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
+5 -12
View File
@@ -210,6 +210,8 @@ pub enum UnscrupulousItem<AccountId, Url> {
type UnscrupulousItemOf<T, I> =
UnscrupulousItem<<T as frame_system::Config>::AccountId, UrlOf<T, I>>;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
#[frame_support::pallet]
pub mod pallet {
use super::*;
@@ -744,10 +746,7 @@ pub mod pallet {
/// A founder or fellow can nominate someone to join the alliance as an Ally.
/// There is no deposit required to the nominator or nominee.
#[pallet::weight(T::WeightInfo::nominate_ally())]
pub fn nominate_ally(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
) -> DispatchResult {
pub fn nominate_ally(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
let nominator = ensure_signed(origin)?;
ensure!(Self::has_voting_rights(&nominator), Error::<T, I>::NoVotingRights);
let who = T::Lookup::lookup(who)?;
@@ -771,10 +770,7 @@ pub mod pallet {
/// Elevate an ally to fellow.
#[pallet::weight(T::WeightInfo::elevate_ally())]
pub fn elevate_ally(
origin: OriginFor<T>,
ally: <T::Lookup as StaticLookup>::Source,
) -> DispatchResult {
pub fn elevate_ally(origin: OriginFor<T>, ally: AccountIdLookupOf<T>) -> DispatchResult {
T::MembershipManager::ensure_origin(origin)?;
let ally = T::Lookup::lookup(ally)?;
ensure!(Self::is_ally(&ally), Error::<T, I>::NotAlly);
@@ -807,10 +803,7 @@ pub mod pallet {
/// Kick a member from the alliance and slash its deposit.
#[pallet::weight(T::WeightInfo::kick_member())]
pub fn kick_member(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
) -> DispatchResult {
pub fn kick_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
T::MembershipManager::ensure_origin(origin)?;
let member = T::Lookup::lookup(who)?;