Files
pezkuwi-subxt/substrate/frame/nfts
Bastian Köcher 5eb816d7a6 Removal of execution strategies (#14387)
* Start

* More work!

* Moar

* More changes

* More fixes

* More worrk

* More fixes

* More fixes to make it compile

* Adds `NoOffchainStorage`

* Pass the extensions

* Small basti making small progress

* Fix merge errors and remove `ExecutionContext`

* Move registration of `ReadRuntimeVersionExt` to `ExecutionExtension`

Instead of registering `ReadRuntimeVersionExt` in `sp-state-machine` it is moved to
`ExecutionExtension` which provides the default extensions.

* Fix compilation

* Register the global extensions inside runtime api instance

* Fixes

* Fix `generate_initial_session_keys` by passing the keystore extension

* Fix the grandpa tests

* Fix more tests

* Fix more tests

* Don't set any heap pages if there isn't an override

* Fix small fallout

* FMT

* Fix tests

* More tests

* Offchain worker custom extensions

* More fixes

* Make offchain tx pool creation reusable

Introduces an `OffchainTransactionPoolFactory` for creating offchain transactions pools that can be
registered in the runtime externalities context. This factory will be required for a later pr to
make the creation of offchain transaction pools easier.

* Fixes

* Fixes

* Set offchain transaction pool in BABE before using it in the runtime

* Add the `offchain_tx_pool` to Grandpa as well

* Fix the nodes

* Print some error when using the old warnings

* Fix merge issues

* Fix compilation

* Rename `babe_link`

* Rename to `offchain_tx_pool_factory`

* Cleanup

* FMT

* Fix benchmark name

* Fix `try-runtime`

* Remove `--execution` CLI args

* Make clippy happy

* Forward bls functions

* Fix docs

* Update UI tests

* Update client/api/src/execution_extensions.rs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Koute <koute@users.noreply.github.com>

* Update client/cli/src/params/import_params.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Update client/api/src/execution_extensions.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Pass the offchain storage to the MMR RPC

* Update client/api/src/execution_extensions.rs

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* Review comments

* Fixes

---------

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
2023-07-11 14:21:38 +00:00
..
2022-12-23 16:07:27 +00:00

NFTs pallet

A pallet for dealing with non-fungible assets.

Overview

The NFTs pallet provides functionality for non-fungible tokens' management, including:

  • Collection Creation
  • NFT Minting
  • NFT Transfers and Atomic Swaps
  • NFT Trading methods
  • Attributes Management
  • NFT Burning

To use it in your runtime, you need to implement nfts::Config.

The supported dispatchable functions are documented in the nfts::Call enum.

Terminology

  • Collection creation: The creation of a new collection.
  • NFT minting: The action of creating a new item within a collection.
  • NFT transfer: The action of sending an item from one account to another.
  • Atomic swap: The action of exchanging items between accounts without needing a 3rd party service.
  • NFT burning: The destruction of an item.
  • Non-fungible token (NFT): An item for which each unit has unique characteristics. There is exactly one instance of such an item in existence and there is exactly one owning account (though that owning account could be a proxy account or multi-sig account).
  • Soul Bound NFT: An item that is non-transferable from the account which it is minted into.

Goals

The NFTs pallet in Substrate is designed to make the following possible:

  • Allow accounts to permissionlessly create nft collections.
  • Allow a named (permissioned) account to mint and burn unique items within a collection.
  • Move items between accounts permissionlessly.
  • Allow a named (permissioned) account to freeze and unfreeze items within a collection or the entire collection.
  • Allow the owner of an item to delegate the ability to transfer the item to some named third-party.
  • Allow third-parties to store information in an NFT without owning it (Eg. save game state).

Interface

Permissionless dispatchables

  • create: Create a new collection by placing a deposit.
  • mint: Mint a new item within a collection (when the minting is public).
  • transfer: Send an item to a new owner.
  • redeposit: Update the deposit amount of an item, potentially freeing funds.
  • approve_transfer: Name a delegate who may authorize a transfer.
  • cancel_approval: Revert the effects of a previous approve_transfer.
  • approve_item_attributes: Name a delegate who may change item's attributes within a namespace.
  • cancel_item_attributes_approval: Revert the effects of a previous approve_item_attributes.
  • set_price: Set the price for an item.
  • buy_item: Buy an item.
  • pay_tips: Pay tips, could be used for paying the creator royalties.
  • create_swap: Create an offer to swap an NFT for another NFT and optionally some fungibles.
  • cancel_swap: Cancel previously created swap offer.
  • claim_swap: Swap items in an atomic way.

Permissioned dispatchables

  • destroy: Destroy a collection. This destroys all the items inside the collection and refunds the deposit.
  • force_mint: Mint a new item within a collection.
  • burn: Destroy an item within a collection.
  • lock_item_transfer: Prevent an individual item from being transferred.
  • unlock_item_transfer: Revert the effects of a previous lock_item_transfer.
  • clear_all_transfer_approvals: Clears all transfer approvals set by calling the approve_transfer.
  • lock_collection: Prevent all items within a collection from being transferred (making them all soul bound).
  • lock_item_properties: Lock item's metadata or attributes.
  • transfer_ownership: Alter the owner of a collection, moving all associated deposits. (Ownership of individual items will not be affected.)
  • set_team: Alter the permissioned accounts of a collection.
  • set_collection_max_supply: Change the max supply of a collection.
  • update_mint_settings: Update the minting settings for collection.

Metadata (permissioned) dispatchables

  • set_attribute: Set a metadata attribute of an item or collection.
  • clear_attribute: Remove a metadata attribute of an item or collection.
  • set_metadata: Set general metadata of an item (E.g. an IPFS address of an image url).
  • clear_metadata: Remove general metadata of an item.
  • set_collection_metadata: Set general metadata of a collection.
  • clear_collection_metadata: Remove general metadata of a collection.

Force (i.e. governance) dispatchables

  • force_create: Create a new collection (the collection id can not be chosen).
  • force_collection_owner: Change collection's owner.
  • force_collection_config: Change collection's config.
  • force_set_attribute: Set an attribute.

Please refer to the Call enum and its associated variants for documentation on each function.

License: Apache-2.0