difftreelog
feat collection manipulation from evm
in: master
1 file changed
pallets/nft/src/lib.rsdiffbeforeafterboth713 mode: CollectionMode) -> DispatchResult {713 mode: CollectionMode) -> DispatchResult {714714715 // Anyone can create a collection715 // Anyone can create a collection716 let who = ensure_signed(origin)?;716 let who = T::CrossAccountId::from_sub(ensure_signed(origin)?);717717718 // Take a (non-refundable) deposit of collection creation718 // Take a (non-refundable) deposit of collection creation719 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);782782783 // call event783 // call event784 Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who.clone()));784 Self::deposit_event(RawEvent::CollectionCreated(next_id, mode.into(), who));785785786 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 {801801802 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 {