mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 10:21:04 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user