mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 21:27:57 +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:
@@ -37,7 +37,7 @@ use crate::Pallet as Uniques;
|
||||
const SEED: u32 = 0;
|
||||
|
||||
fn create_collection<T: Config<I>, I: 'static>(
|
||||
) -> (T::CollectionId, T::AccountId, <T::Lookup as StaticLookup>::Source) {
|
||||
) -> (T::CollectionId, T::AccountId, AccountIdLookupOf<T>) {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||
let collection = T::Helper::collection(0);
|
||||
@@ -49,8 +49,7 @@ fn create_collection<T: Config<I>, I: 'static>(
|
||||
(collection, caller, caller_lookup)
|
||||
}
|
||||
|
||||
fn add_collection_metadata<T: Config<I>, I: 'static>(
|
||||
) -> (T::AccountId, <T::Lookup as StaticLookup>::Source) {
|
||||
fn add_collection_metadata<T: Config<I>, I: 'static>() -> (T::AccountId, AccountIdLookupOf<T>) {
|
||||
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().owner;
|
||||
if caller != whitelisted_caller() {
|
||||
whitelist_account!(caller);
|
||||
@@ -68,7 +67,7 @@ fn add_collection_metadata<T: Config<I>, I: 'static>(
|
||||
|
||||
fn mint_item<T: Config<I>, I: 'static>(
|
||||
index: u16,
|
||||
) -> (T::ItemId, T::AccountId, <T::Lookup as StaticLookup>::Source) {
|
||||
) -> (T::ItemId, T::AccountId, AccountIdLookupOf<T>) {
|
||||
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().admin;
|
||||
if caller != whitelisted_caller() {
|
||||
whitelist_account!(caller);
|
||||
@@ -87,7 +86,7 @@ fn mint_item<T: Config<I>, I: 'static>(
|
||||
|
||||
fn add_item_metadata<T: Config<I>, I: 'static>(
|
||||
item: T::ItemId,
|
||||
) -> (T::AccountId, <T::Lookup as StaticLookup>::Source) {
|
||||
) -> (T::AccountId, AccountIdLookupOf<T>) {
|
||||
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().owner;
|
||||
if caller != whitelisted_caller() {
|
||||
whitelist_account!(caller);
|
||||
@@ -106,7 +105,7 @@ fn add_item_metadata<T: Config<I>, I: 'static>(
|
||||
|
||||
fn add_item_attribute<T: Config<I>, I: 'static>(
|
||||
item: T::ItemId,
|
||||
) -> (BoundedVec<u8, T::KeyLimit>, T::AccountId, <T::Lookup as StaticLookup>::Source) {
|
||||
) -> (BoundedVec<u8, T::KeyLimit>, T::AccountId, AccountIdLookupOf<T>) {
|
||||
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().owner;
|
||||
if caller != whitelisted_caller() {
|
||||
whitelist_account!(caller);
|
||||
|
||||
@@ -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()?;
|
||||
|
||||
Reference in New Issue
Block a user