mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 18:35:41 +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:
@@ -316,28 +316,14 @@ pub mod pallet {
|
||||
let owner = ensure_signed(origin)?;
|
||||
let admin = T::Lookup::lookup(admin)?;
|
||||
|
||||
ensure!(!Class::<T, I>::contains_key(class), Error::<T, I>::InUse);
|
||||
|
||||
let deposit = T::ClassDeposit::get();
|
||||
T::Currency::reserve(&owner, deposit)?;
|
||||
|
||||
Class::<T, I>::insert(
|
||||
Self::do_create_class(
|
||||
class,
|
||||
ClassDetails {
|
||||
owner: owner.clone(),
|
||||
issuer: admin.clone(),
|
||||
admin: admin.clone(),
|
||||
freezer: admin.clone(),
|
||||
total_deposit: deposit,
|
||||
free_holding: false,
|
||||
instances: 0,
|
||||
instance_metadatas: 0,
|
||||
attributes: 0,
|
||||
is_frozen: false,
|
||||
},
|
||||
);
|
||||
Self::deposit_event(Event::Created(class, owner, admin));
|
||||
Ok(())
|
||||
owner.clone(),
|
||||
admin.clone(),
|
||||
T::ClassDeposit::get(),
|
||||
false,
|
||||
Event::Created(class, owner, admin),
|
||||
)
|
||||
}
|
||||
|
||||
/// Issue a new class of non-fungible assets from a privileged origin.
|
||||
@@ -366,25 +352,14 @@ pub mod pallet {
|
||||
T::ForceOrigin::ensure_origin(origin)?;
|
||||
let owner = T::Lookup::lookup(owner)?;
|
||||
|
||||
ensure!(!Class::<T, I>::contains_key(class), Error::<T, I>::InUse);
|
||||
|
||||
Class::<T, I>::insert(
|
||||
Self::do_create_class(
|
||||
class,
|
||||
ClassDetails {
|
||||
owner: owner.clone(),
|
||||
issuer: owner.clone(),
|
||||
admin: owner.clone(),
|
||||
freezer: owner.clone(),
|
||||
total_deposit: Zero::zero(),
|
||||
free_holding,
|
||||
instances: 0,
|
||||
instance_metadatas: 0,
|
||||
attributes: 0,
|
||||
is_frozen: false,
|
||||
},
|
||||
);
|
||||
Self::deposit_event(Event::ForceCreated(class, owner));
|
||||
Ok(())
|
||||
owner.clone(),
|
||||
owner.clone(),
|
||||
Zero::zero(),
|
||||
free_holding,
|
||||
Event::ForceCreated(class, owner),
|
||||
)
|
||||
}
|
||||
|
||||
/// Destroy a class of fungible assets.
|
||||
|
||||
Reference in New Issue
Block a user