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
+18 -19
View File
@@ -60,6 +60,8 @@ pub use pallet::*;
pub use types::*;
pub use weights::WeightInfo;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
#[frame_support::pallet]
pub mod pallet {
use super::*;
@@ -463,10 +465,7 @@ pub mod pallet {
///
/// Weight: `O(1)`
#[pallet::weight(T::WeightInfo::create())]
pub fn create(
origin: OriginFor<T>,
admin: <T::Lookup as StaticLookup>::Source,
) -> DispatchResult {
pub fn create(origin: OriginFor<T>, admin: AccountIdLookupOf<T>) -> DispatchResult {
let collection = NextCollectionId::<T, I>::get();
let owner = T::CreateOrigin::ensure_origin(origin, &collection)?;
@@ -501,7 +500,7 @@ pub mod pallet {
#[pallet::weight(T::WeightInfo::force_create())]
pub fn force_create(
origin: OriginFor<T>,
owner: <T::Lookup as StaticLookup>::Source,
owner: AccountIdLookupOf<T>,
free_holding: bool,
) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
@@ -599,7 +598,7 @@ pub mod pallet {
origin: OriginFor<T>,
collection: T::CollectionId,
item: T::ItemId,
owner: <T::Lookup as StaticLookup>::Source,
owner: AccountIdLookupOf<T>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let owner = T::Lookup::lookup(owner)?;
@@ -628,7 +627,7 @@ pub mod pallet {
origin: OriginFor<T>,
collection: T::CollectionId,
item: T::ItemId,
check_owner: Option<<T::Lookup as StaticLookup>::Source>,
check_owner: Option<AccountIdLookupOf<T>>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let check_owner = check_owner.map(T::Lookup::lookup).transpose()?;
@@ -664,7 +663,7 @@ pub mod pallet {
origin: OriginFor<T>,
collection: T::CollectionId,
item: T::ItemId,
dest: <T::Lookup as StaticLookup>::Source,
dest: AccountIdLookupOf<T>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let dest = T::Lookup::lookup(dest)?;
@@ -876,7 +875,7 @@ pub mod pallet {
pub fn transfer_ownership(
origin: OriginFor<T>,
collection: T::CollectionId,
owner: <T::Lookup as StaticLookup>::Source,
owner: AccountIdLookupOf<T>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let owner = T::Lookup::lookup(owner)?;
@@ -924,9 +923,9 @@ pub mod pallet {
pub fn set_team(
origin: OriginFor<T>,
collection: T::CollectionId,
issuer: <T::Lookup as StaticLookup>::Source,
admin: <T::Lookup as StaticLookup>::Source,
freezer: <T::Lookup as StaticLookup>::Source,
issuer: AccountIdLookupOf<T>,
admin: AccountIdLookupOf<T>,
freezer: AccountIdLookupOf<T>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let issuer = T::Lookup::lookup(issuer)?;
@@ -962,7 +961,7 @@ pub mod pallet {
origin: OriginFor<T>,
collection: T::CollectionId,
item: T::ItemId,
delegate: <T::Lookup as StaticLookup>::Source,
delegate: AccountIdLookupOf<T>,
) -> DispatchResult {
let maybe_check: Option<T::AccountId> = T::ForceOrigin::try_origin(origin)
.map(|_| None)
@@ -1015,7 +1014,7 @@ pub mod pallet {
origin: OriginFor<T>,
collection: T::CollectionId,
item: T::ItemId,
maybe_check_delegate: Option<<T::Lookup as StaticLookup>::Source>,
maybe_check_delegate: Option<AccountIdLookupOf<T>>,
) -> DispatchResult {
let maybe_check: Option<T::AccountId> = T::ForceOrigin::try_origin(origin)
.map(|_| None)
@@ -1066,10 +1065,10 @@ pub mod pallet {
pub fn force_item_status(
origin: OriginFor<T>,
collection: T::CollectionId,
owner: <T::Lookup as StaticLookup>::Source,
issuer: <T::Lookup as StaticLookup>::Source,
admin: <T::Lookup as StaticLookup>::Source,
freezer: <T::Lookup as StaticLookup>::Source,
owner: AccountIdLookupOf<T>,
issuer: AccountIdLookupOf<T>,
admin: AccountIdLookupOf<T>,
freezer: AccountIdLookupOf<T>,
free_holding: bool,
is_frozen: bool,
) -> DispatchResult {
@@ -1507,7 +1506,7 @@ pub mod pallet {
collection: T::CollectionId,
item: T::ItemId,
price: Option<ItemPrice<T, I>>,
whitelisted_buyer: Option<<T::Lookup as StaticLookup>::Source>,
whitelisted_buyer: Option<AccountIdLookupOf<T>>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let whitelisted_buyer = whitelisted_buyer.map(T::Lookup::lookup).transpose()?;