git.delta.rocks / unique-network / refs/commits / aa96639ca75b

difftreelog

feat collection manipulation from evm

Yaroslav Bolyukin2021-04-30parent: #c0388a3.patch.diff
in: master

1 file changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
713 mode: CollectionMode) -> DispatchResult {713 mode: CollectionMode) -> DispatchResult {
714714
715 // Anyone can create a collection715 // Anyone can create a collection
716 let who = ensure_signed(origin)?;716 let who = T::CrossAccountId::from_sub(ensure_signed(origin)?);
717717
718 // Take a (non-refundable) deposit of collection creation718 // Take a (non-refundable) deposit of collection creation
719 let mut imbalance = <<<T as Config>::Currency as Currency<T::AccountId>>::PositiveImbalance>::zero();719 let mut imbalance = <<<T as Config>::Currency as Currency<T::AccountId>>::PositiveImbalance>::zero();
722 T::CollectionCreationPrice::get(),722 T::CollectionCreationPrice::get(),
723 ));723 ));
724 <T as Config>::Currency::settle(724 <T as Config>::Currency::settle(
725 &who,725 who.as_sub(),
726 imbalance,726 imbalance,
727 WithdrawReasons::TRANSFER,727 WithdrawReasons::TRANSFER,
728 ExistenceRequirement::KeepAlive,728 ExistenceRequirement::KeepAlive,
781 <CollectionById<T>>::insert(next_id, new_collection);781 <CollectionById<T>>::insert(next_id, new_collection);
782782
783 // call event783 // call event
784 Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who.clone()));784 Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who));
785785
786 Ok(())786 Ok(())
787 }787 }
799 #[transactional]799 #[transactional]
800 pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {800 pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
801801
802 let sender = ensure_signed(origin)?;802 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
803 let collection = Self::get_collection(collection_id)?;803 let collection = Self::get_collection(collection_id)?;
804 Self::check_owner_permissions(&collection, sender)?;804 Self::check_owner_permissions(&collection, sender)?;
805 if !collection.limits.owner_can_destroy {805 if !collection.limits.owner_can_destroy {