From aa96639ca75b7f4ba4fd36702af91e5ef42c1c1a Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Fri, 30 Apr 2021 15:15:52 +0000 Subject: [PATCH] feat: collection manipulation from evm --- --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -713,7 +713,7 @@ mode: CollectionMode) -> DispatchResult { // Anyone can create a collection - let who = ensure_signed(origin)?; + let who = T::CrossAccountId::from_sub(ensure_signed(origin)?); // Take a (non-refundable) deposit of collection creation let mut imbalance = <<::Currency as Currency>::PositiveImbalance>::zero(); @@ -722,7 +722,7 @@ T::CollectionCreationPrice::get(), )); ::Currency::settle( - &who, + who.as_sub(), imbalance, WithdrawReasons::TRANSFER, ExistenceRequirement::KeepAlive, @@ -781,7 +781,7 @@ >::insert(next_id, new_collection); // call event - Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who.clone())); + Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who)); Ok(()) } @@ -799,7 +799,7 @@ #[transactional] pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult { - let sender = ensure_signed(origin)?; + let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); let collection = Self::get_collection(collection_id)?; Self::check_owner_permissions(&collection, sender)?; if !collection.limits.owner_can_destroy { -- gitstuff