rename denom as type -- first batch

To avoid confusion with coin denom in `x/bank` metadata
This commit is contained in:
Haifeng Xi 2021-06-18 17:07:14 +08:00 committed by GitHub
parent 9d60dfdfeb
commit 0dbfbdbda3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 19 deletions

View File

@ -10,7 +10,7 @@ DRAFT
## Abstract
This ADR defines the `x/nft` module which as a generic implementation of the NFT standard API, with some enhancements.
This ADR defines the `x/nft` module which as a generic implementation of the NFT API, roughly "compatible" with ERC721.
## Context
@ -44,46 +44,46 @@ We will create a module `x/nft`, which contains the following functionality:
#### Metadata
We define a general `Metadata` model for `denom`, it is same as an erc721 contract on Ethereum, which manages all nfts in the contract, and is more like a set of nfts.
We define a `Metadata` model for `NFT Type`, which is comparable to an ERC721 contract on Ethereum, under which a collection of `NFT`s can be created and managed.
```protobuf
message Metadata {
string denom = 1; // Required, unique key
string symbol = 2; // An abbreviated name for NFTs
string name = 3; // A descriptive name for a collection of NFTs
string description = 4; // Description of NFTs
string type = 1; // Required, unique key, alphanumeric
string name = 2;
string symbol = 3;
string description = 4;
}
```
- The `denom` is the name of the same type of nft, just like the address of an erc721 contract on Ethereum.
- The `symbol` is an abbreviated name for NFTs in this denom.
- The `name` is a descriptive name for a collection of NFTs in this denom.
- The `description` is a detailed description of denom, which extends the function of erc721.
- The `type` is the identifier of the NFT type/class.
- The `name` is a descriptive name of this NFT type.
- The `symbol` is the symbol usually shown on exchanges for this NFT type.
- The `description` is a detailed description of this NFT type.
#### NFT
We define a general NFT model and `x/nft` module only stores NFTs by id.
We define a general model for `NFT` as follows.
```protobuf
message NFT {
string denom = 1;
string id = 2;
string uri = 3;
string type = 1; // The type of this NFT
string id = 2; // The identifier of this NFT
string uri = 3;
google.protobuf.Any data = 4;
}
```
The NFT conforms to the following specifications:
- The `id` is an immutable field used as a unique identifier in the same denom, It is generated by the system and may be expanded to DID in the future. NFT identifiers don't currently have a naming convention but can be used in association with existing Hub attributes, e.g., defining an NFT's identifier as an immutable Hub address allows its integration into existing Hub account management modules.
- The `id` is an immutable field used as a unique identifier within the scope of an NFT type. It is specified by the creator of the NFT and may be expanded to use DID in the future. NFT identifiers don't currently have a naming convention but can be used in association with existing Hub attributes, e.g., defining an NFT's identifier as an immutable Hub address allows its integration into existing Hub account management modules.
We envision that identifiers can accommodate mint and transfer actions.
The Id is also the primary index for storing NFTs.
The `id` is also the primary index for storing NFTs.
```
{denom}/{id} --> NFT (bytes)
{type}/{id} --> NFT (bytes)
```
- The `uri` is the off-chain storage address of nft attribute `data`, such as ipfs, etc.
- The `uri` points to an immutable off-chain resource containing more attributes about his NFT.
- The `data` is mutable field and allows attaching special information to the NFT, for example:
@ -376,4 +376,4 @@ Other networks in the Cosmos ecosystem could design and implement their own NFT
- Initial discussion: https://github.com/cosmos/cosmos-sdk/discussions/9065
- x/nft: initialize module: https://github.com/cosmos/cosmos-sdk/pull/9174
- [ADR 033](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-033-protobuf-inter-module-comm.md)
- [ADR 033](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-033-protobuf-inter-module-comm.md)