|
| 1 | +# NFTs pallet |
| 2 | + |
| 3 | +A pallet for dealing with non-fungible assets. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The NFTs pallet provides functionality for non-fungible tokens' management, including: |
| 8 | + |
| 9 | +* Collection Creation |
| 10 | +* NFT Minting |
| 11 | +* NFT Transfers and Atomic Swaps |
| 12 | +* NFT Trading methods |
| 13 | +* Attributes Management |
| 14 | +* NFT Burning |
| 15 | + |
| 16 | +To use it in your runtime, you need to implement [`nfts::Config`](https://paritytech.github.io/substrate/master/pallet_nfts/pallet/trait.Config.html). |
| 17 | + |
| 18 | +The supported dispatchable functions are documented in the [`nfts::Call`](https://paritytech.github.io/substrate/master/pallet_nfts/pallet/enum.Call.html) enum. |
| 19 | + |
| 20 | +### Terminology |
| 21 | + |
| 22 | +* **Collection creation:** The creation of a new collection. |
| 23 | +* **NFT minting:** The action of creating a new item within a collection. |
| 24 | +* **NFT transfer:** The action of sending an item from one account to another. |
| 25 | +* **Atomic swap:** The action of exchanging items between accounts without needing a 3rd party service. |
| 26 | +* **NFT burning:** The destruction of an item. |
| 27 | +* **Non-fungible token (NFT):** An item for which each unit has unique characteristics. There is exactly |
| 28 | + 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). |
| 29 | +* **Soul Bound NFT:** An item that is non-transferable from the account which it is minted into. |
| 30 | + |
| 31 | +### Goals |
| 32 | + |
| 33 | +The NFTs pallet in Substrate is designed to make the following possible: |
| 34 | + |
| 35 | +* Allow accounts to permissionlessly create nft collections. |
| 36 | +* Allow a named (permissioned) account to mint and burn unique items within a collection. |
| 37 | +* Move items between accounts permissionlessly. |
| 38 | +* Allow a named (permissioned) account to freeze and unfreeze items within a |
| 39 | + collection or the entire collection. |
| 40 | +* Allow the owner of an item to delegate the ability to transfer the item to some |
| 41 | + named third-party. |
| 42 | +* Allow third-parties to store information in an NFT _without_ owning it (Eg. save game state). |
| 43 | + |
| 44 | +## Interface |
| 45 | + |
| 46 | +### Permissionless dispatchables |
| 47 | + |
| 48 | +* `create`: Create a new collection by placing a deposit. |
| 49 | +* `mint`: Mint a new item within a collection (when the minting is public). |
| 50 | +* `transfer`: Send an item to a new owner. |
| 51 | +* `redeposit`: Update the deposit amount of an item, potentially freeing funds. |
| 52 | +* `approve_transfer`: Name a delegate who may authorize a transfer. |
| 53 | +* `cancel_approval`: Revert the effects of a previous `approve_transfer`. |
| 54 | +* `approve_item_attributes`: Name a delegate who may change item's attributes within a namespace. |
| 55 | +* `cancel_item_attributes_approval`: Revert the effects of a previous `approve_item_attributes`. |
| 56 | +* `set_price`: Set the price for an item. |
| 57 | +* `buy_item`: Buy an item. |
| 58 | +* `pay_tips`: Pay tips, could be used for paying the creator royalties. |
| 59 | +* `create_swap`: Create an offer to swap an NFT for another NFT and optionally some fungibles. |
| 60 | +* `cancel_swap`: Cancel previously created swap offer. |
| 61 | +* `claim_swap`: Swap items in an atomic way. |
| 62 | + |
| 63 | + |
| 64 | +### Permissioned dispatchables |
| 65 | + |
| 66 | +* `destroy`: Destroy a collection. This destroys all the items inside the collection and refunds the deposit. |
| 67 | +* `force_mint`: Mint a new item within a collection. |
| 68 | +* `burn`: Destroy an item within a collection. |
| 69 | +* `lock_item_transfer`: Prevent an individual item from being transferred. |
| 70 | +* `unlock_item_transfer`: Revert the effects of a previous `lock_item_transfer`. |
| 71 | +* `clear_all_transfer_approvals`: Clears all transfer approvals set by calling the `approve_transfer`. |
| 72 | +* `lock_collection`: Prevent all items within a collection from being transferred (making them all `soul bound`). |
| 73 | +* `lock_item_properties`: Lock item's metadata or attributes. |
| 74 | +* `transfer_ownership`: Alter the owner of a collection, moving all associated deposits. (Ownership of individual items will not be affected.) |
| 75 | +* `set_team`: Alter the permissioned accounts of a collection. |
| 76 | +* `set_collection_max_supply`: Change the max supply of a collection. |
| 77 | +* `update_mint_settings`: Update the minting settings for collection. |
| 78 | + |
| 79 | + |
| 80 | +### Metadata (permissioned) dispatchables |
| 81 | + |
| 82 | +* `set_attribute`: Set a metadata attribute of an item or collection. |
| 83 | +* `clear_attribute`: Remove a metadata attribute of an item or collection. |
| 84 | +* `set_metadata`: Set general metadata of an item (E.g. an IPFS address of an image url). |
| 85 | +* `clear_metadata`: Remove general metadata of an item. |
| 86 | +* `set_collection_metadata`: Set general metadata of a collection. |
| 87 | +* `clear_collection_metadata`: Remove general metadata of a collection. |
| 88 | + |
| 89 | + |
| 90 | +### Force (i.e. governance) dispatchables |
| 91 | + |
| 92 | +* `force_create`: Create a new collection (the collection id can not be chosen). |
| 93 | +* `force_collection_owner`: Change collection's owner. |
| 94 | +* `force_collection_config`: Change collection's config. |
| 95 | +* `force_set_attribute`: Set an attribute. |
| 96 | + |
| 97 | +Please refer to the [`Call`](https://paritytech.github.io/substrate/master/pallet_nfts/pallet/enum.Call.html) enum |
| 98 | +and its associated variants for documentation on each function. |
| 99 | + |
| 100 | +## Related Modules |
| 101 | + |
| 102 | +* [`System`](https://docs.rs/frame-system/latest/frame_system/) |
| 103 | +* [`Support`](https://docs.rs/frame-support/latest/frame_support/) |
| 104 | +* [`Assets`](https://docs.rs/pallet-assets/latest/pallet_assets/) |
| 105 | + |
| 106 | +License: Apache-2.0 |
0 commit comments