pub struct Pallet<T, I = ()>(_);
Expand description

The pallet implementing the on-chain logic.

Implementations§

Get the owner of the item, if the item exists.

Get the owner of the item, if the item exists.

Issue a new collection of non-fungible items from a public origin.

This new collection has no items initially and its owner is the origin.

The origin must be Signed and the sender must have sufficient funds free.

ItemDeposit funds of sender are reserved.

Parameters:

  • collection: The identifier of the new collection. This must not be currently in use.
  • admin: The admin of this collection. The admin is the initial address of each member of the collection’s admin team.

Emits Created event when successful.

Weight: O(1)

Issue a new collection of non-fungible items from a privileged origin.

This new collection has no items initially.

The origin must conform to ForceOrigin.

Unlike create, no funds are reserved.

  • collection: The identifier of the new item. This must not be currently in use.
  • owner: The owner of this collection of items. The owner has full superuser permissions over this item, but may later change and configure the permissions using transfer_ownership and set_team.

Emits ForceCreated event when successful.

Weight: O(1)

Destroy a collection of fungible items.

The origin must conform to ForceOrigin or must be Signed and the sender must be the owner of the collection.

  • collection: The identifier of the collection to be destroyed.
  • witness: Information on the items minted in the collection. This must be correct.

Emits Destroyed event when successful.

Weight: O(n + m) where:

  • n = witness.items
  • m = witness.item_metadatas
  • a = witness.attributes

Mint an item of a particular collection.

The origin must be Signed and the sender must be the Issuer of the collection.

  • collection: The collection of the item to be minted.
  • item: The item value of the item to be minted.
  • beneficiary: The initial owner of the minted item.

Emits Issued event when successful.

Weight: O(1)

Destroy a single item.

Origin must be Signed and the sender should be the Admin of the collection.

  • collection: The collection of the item to be burned.
  • item: The item of the item to be burned.
  • check_owner: If Some then the operation will fail with WrongOwner unless the item is owned by this value.

Emits Burned with the actual amount burned.

Weight: O(1) Modes: check_owner.is_some().

Move an item from the sender account to another.

This resets the approved account of the item.

Origin must be Signed and the signing account must be either:

  • the Admin of the collection;
  • the Owner of the item;
  • the approved delegate for the item (in this case, the approval is reset).

Arguments:

  • collection: The collection of the item to be transferred.
  • item: The item of the item to be transferred.
  • dest: The account to receive ownership of the item.

Emits Transferred.

Weight: O(1)

Reevaluate the deposits on some items.

Origin must be Signed and the sender should be the Owner of the collection.

  • collection: The collection to be frozen.
  • items: The items of the collection whose deposits will be reevaluated.

NOTE: This exists as a best-effort function. Any items which are unknown or in the case that the owner account does not have reservable funds to pay for a deposit increase are ignored. Generally the owner isn’t going to call this on items whose existing deposit is less than the refreshed deposit as it would only cost them, so it’s of little consequence.

It will still return an error in the case that the collection is unknown of the signer is not permitted to call it.

Weight: O(items.len())

Disallow further unprivileged transfer of an item.

Origin must be Signed and the sender should be the Freezer of the collection.

  • collection: The collection of the item to be frozen.
  • item: The item of the item to be frozen.

Emits Frozen.

Weight: O(1)

Re-allow unprivileged transfer of an item.

Origin must be Signed and the sender should be the Freezer of the collection.

  • collection: The collection of the item to be thawed.
  • item: The item of the item to be thawed.

Emits Thawed.

Weight: O(1)

Disallow further unprivileged transfers for a whole collection.

Origin must be Signed and the sender should be the Freezer of the collection.

  • collection: The collection to be frozen.

Emits CollectionFrozen.

Weight: O(1)

Re-allow unprivileged transfers for a whole collection.

Origin must be Signed and the sender should be the Admin of the collection.

  • collection: The collection to be thawed.

Emits CollectionThawed.

Weight: O(1)

Change the Owner of a collection.

Origin must be Signed and the sender should be the Owner of the collection.

  • collection: The collection whose owner should be changed.
  • owner: The new Owner of this collection. They must have called set_accept_ownership with collection in order for this operation to succeed.

Emits OwnerChanged.

Weight: O(1)

Change the Issuer, Admin and Freezer of a collection.

Origin must be Signed and the sender should be the Owner of the collection.

  • collection: The collection whose team should be changed.
  • issuer: The new Issuer of this collection.
  • admin: The new Admin of this collection.
  • freezer: The new Freezer of this collection.

Emits TeamChanged.

Weight: O(1)

Approve an item to be transferred by a delegated third-party account.

The origin must conform to ForceOrigin or must be Signed and the sender must be either the owner of the item or the admin of the collection.

  • collection: The collection of the item to be approved for delegated transfer.
  • item: The item of the item to be approved for delegated transfer.
  • delegate: The account to delegate permission to transfer the item.

Important NOTE: The approved account gets reset after each transfer.

Emits ApprovedTransfer on success.

Weight: O(1)

Cancel the prior approval for the transfer of an item by a delegate.

Origin must be either:

  • the Force origin;
  • Signed with the signer being the Admin of the collection;
  • Signed with the signer being the Owner of the item;

Arguments:

  • collection: The collection of the item of whose approval will be cancelled.
  • item: The item of the item of whose approval will be cancelled.
  • maybe_check_delegate: If Some will ensure that the given account is the one to which permission of transfer is delegated.

Emits ApprovalCancelled on success.

Weight: O(1)

Alter the attributes of a given item.

Origin must be ForceOrigin.

  • collection: The identifier of the item.
  • owner: The new Owner of this item.
  • issuer: The new Issuer of this item.
  • admin: The new Admin of this item.
  • freezer: The new Freezer of this item.
  • free_holding: Whether a deposit is taken for holding an item of this collection.
  • is_frozen: Whether this collection is frozen except for permissioned/admin instructions.

Emits ItemStatusChanged with the identity of the item.

Weight: O(1)

Set an attribute for a collection or item.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the collection.

If the origin is Signed, then funds of signer are reserved according to the formula: MetadataDepositBase + DepositPerByte * (key.len + value.len) taking into account any already reserved funds.

  • collection: The identifier of the collection whose item’s metadata to set.
  • maybe_item: The identifier of the item whose metadata to set.
  • key: The key of the attribute.
  • value: The value to which to set the attribute.

Emits AttributeSet.

Weight: O(1)

Clear an attribute for a collection or item.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the collection.

Any deposit is freed for the collection’s owner.

  • collection: The identifier of the collection whose item’s metadata to clear.
  • maybe_item: The identifier of the item whose metadata to clear.
  • key: The key of the attribute.

Emits AttributeCleared.

Weight: O(1)

Set the metadata for an item.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the collection.

If the origin is Signed, then funds of signer are reserved according to the formula: MetadataDepositBase + DepositPerByte * data.len taking into account any already reserved funds.

  • collection: The identifier of the collection whose item’s metadata to set.
  • item: The identifier of the item whose metadata to set.
  • data: The general information of this item. Limited in length by StringLimit.
  • is_frozen: Whether the metadata should be frozen against further changes.

Emits MetadataSet.

Weight: O(1)

Clear the metadata for an item.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the item.

Any deposit is freed for the collection’s owner.

  • collection: The identifier of the collection whose item’s metadata to clear.
  • item: The identifier of the item whose metadata to clear.

Emits MetadataCleared.

Weight: O(1)

Set the metadata for a collection.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the collection.

If the origin is Signed, then funds of signer are reserved according to the formula: MetadataDepositBase + DepositPerByte * data.len taking into account any already reserved funds.

  • collection: The identifier of the item whose metadata to update.
  • data: The general information of this item. Limited in length by StringLimit.
  • is_frozen: Whether the metadata should be frozen against further changes.

Emits CollectionMetadataSet.

Weight: O(1)

Clear the metadata for a collection.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the collection.

Any deposit is freed for the collection’s owner.

  • collection: The identifier of the collection whose metadata to clear.

Emits CollectionMetadataCleared.

Weight: O(1)

Set (or reset) the acceptance of ownership for a particular account.

Origin must be Signed and if maybe_collection is Some, then the signer must have a provider reference.

  • maybe_collection: The identifier of the collection whose ownership the signer is willing to accept, or if None, an indication that the signer is willing to accept no ownership transferal.

Emits OwnershipAcceptanceChanged.

Set the maximum amount of items a collection could have.

Origin must be either ForceOrigin or Signed and the sender should be the Owner of the collection.

Note: This function can only succeed once per collection.

  • collection: The identifier of the collection to change.
  • max_supply: The maximum amount of items a collection could have.

Emits CollectionMaxSupplySet event when successful.

Set (or reset) the price for an item.

Origin must be Signed and must be the owner of the asset item.

  • collection: The collection of the item.
  • item: The item to set the price for.
  • price: The price for the item. Pass None, to reset the price.
  • buyer: Restricts the buy operation to a specific account.

Emits ItemPriceSet on success if the price is not None. Emits ItemPriceRemoved on success if the price is None.

Allows to buy an item if it’s up for sale.

Origin must be Signed and must not be the owner of the item.

  • collection: The collection of the item.
  • item: The item the sender wants to buy.
  • bid_price: The price the sender is willing to pay.

Emits ItemBought on success.

Trait Implementations§

Get the benchmarks available for this pallet. Generally there is one benchmark per extrinsic, so these are sometimes just called “extrinsics”. Read more
Run the benchmarks for this pallet.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Create a collection of nonfungible items to be owned by who and managed by admin.

Formats the value using the given formatter. Read more
The witness data needed to destroy an item.
Provide the appropriate witness data needed to destroy an item.
Destroy an existing fungible item. Read more
Returns the current storage version as supported by the pallet.
Returns the on-chain storage version of the pallet as stored in the storage.
The block is being finalized. Implement to have something happen.
This will be run when the block is being finalized (before on_finalize). Implement to have something happen using the remaining weight. Will not fire if the remaining weight is 0. Return the weight used, the hook will subtract it from current weight used and pass the result to the next on_idle hook if it exists. Read more
The block is being initialized. Implement to have something happen. Read more
Perform a module upgrade. Read more
Execute the sanity checks of this pallet, per block. Read more
Execute some pre-checks prior to a runtime upgrade. Read more
Execute some post-checks after a runtime upgrade. Read more
Implementing this function on a module allows you to perform long-running tasks that make (by default) validators generate transactions that feed results of those long-running computations back on chain. Read more
Run integrity test. Read more

Returns the attribute value of item of collection corresponding to key.

When key is empty, we return the item metadata value.

By default this is None; no attributes are defined.

Returns the attribute value of item of collection corresponding to key.

When key is empty, we return the item metadata value.

By default this is None; no attributes are defined.

Returns true if the item of collection may be transferred.

Default implementation is that all items are transferable.

Type for identifying an item.
Type for identifying a collection (an identifier for an independent collection of items). Read more
Returns the owner of item of collection, or None if the item doesn’t exist (or somehow has no owner). Read more
Returns the owner of the collection, if there is one. For many NFTs this may not make any sense, so users of this API should not be surprised to find a collection results in None here. Read more
Returns the strongly-typed attribute value of item of collection corresponding to key. Read more
Returns the strongly-typed attribute value of collection corresponding to key. Read more

Returns an iterator of the collections in existence.

NOTE: iterating this list invokes a storage read per item.

Returns an iterator of the items of a collection in existence.

NOTE: iterating this list invokes a storage read per item.

Returns an iterator of the items of all collections owned by who.

NOTE: iterating this list invokes a storage read per item.

Returns an iterator of the items of collection owned by who.

NOTE: iterating this list invokes a storage read per item.

Run integrity test. Read more
Mint some item of collection to be owned by who. Read more
Burn some item of collection. Read more
Set attribute value of item of collection’s key. Read more
Attempt to set the strongly-typed attribute value of item of collection’s key. Read more
Set attribute value of collection’s key. Read more
Attempt to set the strongly-typed attribute value of collection’s key. Read more
This function is being called after every block import (when fully synced). Read more
The block is being finalized. Implement to have something happen. Read more
Something that should happen at genesis.
The block is being finalized. Implement to have something happen in case there is leftover weight. Check the passed remaining_weight to make sure it is high enough to allow for your pallet’s extra computation. Read more
The block is being initialized. Implement to have something happen. Read more
Perform a module upgrade. Read more
Execute some pre-checks prior to a runtime upgrade. Read more
Execute some post-checks after a runtime upgrade. Read more
Index of the pallet as configured in the runtime.
Name of the pallet as configured in the runtime.
Name of the Rust module containing the pallet.
Version of the crate containing the pallet.
The number of pallets’ information that this type represents. Read more
All of the pallets’ information that this type represents.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Transfer item of collection into destination account.
Execute the state checks.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert from a value of T into an equivalent instance of Option<Self>. Read more
Consume self to return Some equivalent value of Option<T>. Read more
Converts self into T using Into<T>. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more
Compare self to key and return true if they are equal.
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Cast reference.
Cast reference.
Cast mutable reference.
Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Generate a storage key unique to this runtime upgrade. Read more
Get temporary storage data written by Self::set_temp_storage. Read more
Write some temporary data to a specific storage that can be read (potentially in post-upgrade hook) via Self::get_temp_storage. Read more
Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Convert from a value of T into an equivalent instance of Self. Read more
Consume self to return an equivalent value of T. Read more
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The counterpart to unchecked_from.
Consume self to return an equivalent value of T.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more