Add nonfungibles::Create Trait & Implement for Uniques (#9438)

* Add nonfungibles::Create Trait & Implement for Uniques

Closes #9419

* Formatting

* Remove default implementation (`TokenError::Unsupported`) from `Create` trait

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Formatting

* Do not wrap parameters in Options

* Formatting

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Dan ForbesandBastian Köcher authored and GitHub committed 2021-07-28 13:39:04 +00:00
1 parent 52aa9c2ef7
commit 76611ba6a3
4 files changed
+74 -40

No files matched your search

+32
View File
@@ -48,6 +48,38 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Ok(())
}
pub(super) fn do_create_class(
class: T::ClassId,
owner: T::AccountId,
admin: T::AccountId,
deposit: DepositBalanceOf<T, I>,
free_holding: bool,
event: Event<T, I>,
) -> DispatchResult {
ensure!(!Class::<T, I>::contains_key(class), Error::<T, I>::InUse);
T::Currency::reserve(&owner, deposit)?;
Class::<T, I>::insert(
class,
ClassDetails {
owner: owner.clone(),
issuer: admin.clone(),
admin: admin.clone(),
freezer: admin.clone(),
total_deposit: deposit,
free_holding,
instances: 0,
instance_metadatas: 0,
attributes: 0,
is_frozen: false,
},
);
Self::deposit_event(event);
Ok(())
}
pub(super) fn do_mint(
class: T::ClassId,
instance: T::InstanceId,