From 9329ca8ea18f50af259a460e01f3ab9d43f60f84 Mon Sep 17 00:00:00 2001 From: Lisska Date: Tue, 4 Jun 2024 16:51:42 +0200 Subject: [PATCH 01/12] Create new metadata format 4_2_2 --- src/standard/TIP-4/2_2 | 171 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 src/standard/TIP-4/2_2 diff --git a/src/standard/TIP-4/2_2 b/src/standard/TIP-4/2_2 new file mode 100644 index 000000000..3ae2d9267 --- /dev/null +++ b/src/standard/TIP-4/2_2 @@ -0,0 +1,171 @@ +--- +title: 4.2.2 New JSON Metadata +sidebar_position: 2 +slug: /standard/TIP-4.2.2 +--- + +# Non-Fungible Token JSON Metadata (TIP-4.2.2) + +Requires: [TIP-6.1](./../TIP-6/1.md) + +## Abstract + +This is an alternative standard for storing metadata, but in a more familiar form for EVM users of such networks. It is not compatible with basic TYPE4.2 + +This standard proposes storing metadata outside the blockchain (centralized backing, ipfs, etc.) + +## Motivation + +The implementation below solves several problems at once: +- For Mystery-type collections, it makes reveal cheap and makes it easier to execute +- Helps avoid storing json onchain. Storing and replacing json in a contract is expensive. +- Makes it possible to change metadata without making a bunch of transactions to the blockchain +- Familiar metadata format for those who have already released collections on EVM +- In the future, this will make it easier to bridge/issue nft on multiple blockchains + +## Specification + +The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC 2119](https://datatracker.ietf.org/doc/html/rfc2119) + +## TIP4_2_2Collection + +New features appear in the collection. + +```solidity +pragma ever-solidity >= 0.62.0; + +interface ITIP4_2_2Collection { + + /// The TIP-6.1 identifier for this interface is 0x244a5200 + + /// @notice The event emits when set or change collection metadata + event collectionMetadataUpdated(); + + /// @notice The event emits when set or change NFTs metadata + event nftMetadataUpdated(); + + /// @notice build url to get metadata for NFT + /// @return nftUrl - url to get metadata for NFT + /// @param parts is TvmCell from NFT for build the link to metadata + function getNftUrl(TvmCell parts) external responsible returns (string nftUrl); + + /// @notice build url to get metadata for NFT + /// @return collectionUrl - url to get metadata for NFT + function getCollectionUrl() external view responsible returns (string collectionUrl); + +} +``` +**NOTE** The [TIP-6.1](./../TIP-6/1.md) identifier for this interface is `0x244a5200`. + +### TIP4_2_2Collection.getNftUrl() +```solidity +function getNftUrl(TvmCell parts) external responsible returns (string nftUrl); +``` +* `parts` (`TvmCell`) - is TvmCell from NFT for build the link to metadata + +The function, based on the main link and the part it received, builds the final link to the NFT metadata. In the case of collections, mystery box can describe more complex logic in which the display of the final link will depend on the flag the sale of the collection is completed or not. + +### TIP4_2_2Collection.getCollectionUrl() +```solidity +function getCollectionUrl() external view responsible returns (string collectionUrl); +``` +The function is analogous to the getJson function in the Type4.2 standard but returns not json but a link to the json metadata of the collection. + +```solidity +event collectionMetadataUpdated(); +event nftMetadataUpdated(); +``` +You must emit them when you change the metadata of collection or NFT. + +## TIP4_2_2NFT + +Each NFT now stores only a part of the link by which the metadata for it can be uniquely identified, and the metadata can be obtained by attaching this part to the collection function `getNftUrl(TvmCell parts)`. + +**NOTE** The [TIP-6.1](./../TIP-6/1.md) identifier for this interface is `0x7239d7b1`. +```solidity +pragma ever-solidity >= 0.62.0; + +interface ITIP4_2_2NFT { + + + /// The TIP-6.1 identifier for this interface is 0x7239d7b1. + + /// @notice event emits when NFT part update + event metadataUpdated(); + + /// @notice NFT part to get metadata + /// @return part - TvmCell allows to build URL with metadata for this NFT + function getUrlParts() external view responsible returns (TvmCell part); + +} +``` + +### ITIP4_2_2NFT.getUrlParts() +```solidity +function getUrlParts() external view responsible returns (TvmCell part); +``` +The function returns the part identifying the NFT in the form of a TvmCell, which gives greater variability. In the simplest version, this could be id. + +You must emit event `metadataUpdated()` when NFT part update. + +### Metadata format +JSON metadata type: "Basic NFT" + +The `Basic NFT` use for links to files stores in web. JSON fields contain information about item, files and preview info. + +The `Basic NFT` describes fields that must be in JSON + +| Field name | type | Value | Description | +|----------------------|--------|----------------------------------------------------------------------------------------------------|-----------------------------| +| **type** | string | "Basic NFT" | Constant name for this type | +| **name** | string || Name of the object | | +| **description** | string || Description of the object | | +| **preview** | object || Object preview | | +| **preview.source** | string || Link to object. Contains protocol and data source. Delimiter is **:** | | +| **preview.mimetype** | string || [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of object | | +| **files** | array || Array of objects. | | +| **file.source** | string || Link to object. Contains protocol and data source. Delimiter is **:** | | +| **file.mimetype** | string || [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of object | | +| **attributes** | array || Array of objects. | | +| **attributes.trait_type** | string || type of attribute (body, t-shirt ...) | | +| **attributes.value** | string || value of attribute (strong, blue ...) | | +| **external_url** | string || URL to website | | + +### Example + +```JSON +{ + "type": "Basic NFT", + "name": "Sample Name", + "description": "Hello world!", + "preview": { + "source": "https://everscale.network/images/Backgrounds/Main/main-hero.png", + "mimetype": "image/png" + }, + "files": [ + { + "source": "https://everscale.network/images/Backgrounds/Main/main-hero.png", + "mimetype": "image/png" + } + ], + "external_url": "https://everscale.network" +} +``` + +You can extend `Basic NFT` type for your custom fields. + +## How to add the new JSON metadata type? + +For added new metadata type of [TIP-4.2](2.md) + +- Create product that use new JSON type. +- Send PR for change the docs. +- Explain why it will be in Standard. + +## References + +- [Ethereum EIP-721](https://eips.ethereum.org/EIPS/eip-721) +- [Solana v1.2.0](https://docs.metaplex.com/token-metadata/specification) +- [TON NFT](https://github.com/ton-blockchain/TIPs/issues/62), [TON DATA](https://github.com/ton-blockchain/TIPs/issues/64) +- [Tezos TZIP12](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-12/tzip-12.md) +- [BNS BEP721](https://docs.binance.org/smart-chain/developer/nft-metadata-standard.html) From 4848b4a13cc06c4b16361a088f003e873ba51ad7 Mon Sep 17 00:00:00 2001 From: Lisska Date: Tue, 4 Jun 2024 16:52:06 +0200 Subject: [PATCH 02/12] Rename 2_2 to 2_2.md --- src/standard/TIP-4/{2_2 => 2_2.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/standard/TIP-4/{2_2 => 2_2.md} (100%) diff --git a/src/standard/TIP-4/2_2 b/src/standard/TIP-4/2_2.md similarity index 100% rename from src/standard/TIP-4/2_2 rename to src/standard/TIP-4/2_2.md From f4ab5854f15efcffaf21adf9de6c27e0f5541707 Mon Sep 17 00:00:00 2001 From: Lisska Date: Tue, 4 Jun 2024 16:56:46 +0200 Subject: [PATCH 03/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index 3ae2d9267..e9ce0a7f6 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -90,7 +90,7 @@ interface ITIP4_2_2NFT { /// The TIP-6.1 identifier for this interface is 0x7239d7b1. - /// @notice event emits when NFT part update + /// @notice event emits when update NFT part. event metadataUpdated(); /// @notice NFT part to get metadata @@ -127,8 +127,8 @@ The `Basic NFT` describes fields that must be in JSON | **file.source** | string || Link to object. Contains protocol and data source. Delimiter is **:** | | | **file.mimetype** | string || [Mime type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of object | | | **attributes** | array || Array of objects. | | -| **attributes.trait_type** | string || type of attribute (body, t-shirt ...) | | -| **attributes.value** | string || value of attribute (strong, blue ...) | | +| **attributes.trait_type** | string || Type of attribute (Base, Eyes ...) | | +| **attributes.value** | string || Value of attribute (Starfish, Blue ...) | | | **external_url** | string || URL to website | | ### Example @@ -148,9 +148,19 @@ The `Basic NFT` describes fields that must be in JSON "mimetype": "image/png" } ], + "attributes": [ + { + "trait_type": "Base", + "value": "Starfish” + }, + { + "trait_type": "Eyes", + "value": "blue" + } "external_url": "https://everscale.network" } ``` +You NFT may not contain a block `attributes`. You can extend `Basic NFT` type for your custom fields. From 06ce9fe50b7d8732162a275b8374f4c30b54d2ec Mon Sep 17 00:00:00 2001 From: Lisska Date: Tue, 4 Jun 2024 17:00:42 +0200 Subject: [PATCH 04/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index e9ce0a7f6..6a7684936 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -113,7 +113,7 @@ JSON metadata type: "Basic NFT" The `Basic NFT` use for links to files stores in web. JSON fields contain information about item, files and preview info. -The `Basic NFT` describes fields that must be in JSON +The `Basic NFT` describes fields that must be in JSON. The “attributes” field may not be present in the JSON metadata. | Field name | type | Value | Description | |----------------------|--------|----------------------------------------------------------------------------------------------------|-----------------------------| @@ -156,11 +156,10 @@ The `Basic NFT` describes fields that must be in JSON { "trait_type": "Eyes", "value": "blue" - } + } ] "external_url": "https://everscale.network" } ``` -You NFT may not contain a block `attributes`. You can extend `Basic NFT` type for your custom fields. From ff7cdc136b6047195067ad5427d39cfc7588145e Mon Sep 17 00:00:00 2001 From: Lisska Date: Fri, 7 Jun 2024 16:07:20 +0200 Subject: [PATCH 05/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index 6a7684936..e47ebbc35 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -113,7 +113,8 @@ JSON metadata type: "Basic NFT" The `Basic NFT` use for links to files stores in web. JSON fields contain information about item, files and preview info. -The `Basic NFT` describes fields that must be in JSON. The “attributes” field may not be present in the JSON metadata. +The `Basic NFT` describes fields that must be in JSON. +The `attributes` field may not be present in the JSON metadata. | Field name | type | Value | Description | |----------------------|--------|----------------------------------------------------------------------------------------------------|-----------------------------| From cfe3e7db7eb1154d98e4d82c7aebe7d0fa2a6dd7 Mon Sep 17 00:00:00 2001 From: Lisska Date: Fri, 7 Jun 2024 16:18:03 +0200 Subject: [PATCH 06/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index e47ebbc35..b8be2b0f1 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -3,9 +3,11 @@ title: 4.2.2 New JSON Metadata sidebar_position: 2 slug: /standard/TIP-4.2.2 --- - # Non-Fungible Token JSON Metadata (TIP-4.2.2) +author: ELena Khramtsova , Aleksandr Khramtsov +type: Contract +created: 2024-06-07 Requires: [TIP-6.1](./../TIP-6/1.md) ## Abstract From 04eb40b762f79470984cea7d9186bebeaf78e6a4 Mon Sep 17 00:00:00 2001 From: Lisska Date: Fri, 7 Jun 2024 16:18:33 +0200 Subject: [PATCH 07/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index b8be2b0f1..f54b5601a 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -4,12 +4,12 @@ sidebar_position: 2 slug: /standard/TIP-4.2.2 --- # Non-Fungible Token JSON Metadata (TIP-4.2.2) - +``` author: ELena Khramtsova , Aleksandr Khramtsov type: Contract created: 2024-06-07 Requires: [TIP-6.1](./../TIP-6/1.md) - +``` ## Abstract This is an alternative standard for storing metadata, but in a more familiar form for EVM users of such networks. It is not compatible with basic TYPE4.2 From 8712cdd247ca6de5014e67b4b9e6175bbd97c0e7 Mon Sep 17 00:00:00 2001 From: Lisska Date: Fri, 7 Jun 2024 16:19:09 +0200 Subject: [PATCH 08/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index f54b5601a..a5e8ca692 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -8,7 +8,7 @@ slug: /standard/TIP-4.2.2 author: ELena Khramtsova , Aleksandr Khramtsov type: Contract created: 2024-06-07 -Requires: [TIP-6.1](./../TIP-6/1.md) +Requires: TIP-6 ``` ## Abstract From 5a4a9c6d79176d1ac310846ec06dd6232fe6f0b0 Mon Sep 17 00:00:00 2001 From: Lisska Date: Fri, 7 Jun 2024 16:19:37 +0200 Subject: [PATCH 09/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index a5e8ca692..ee3427663 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -12,7 +12,7 @@ Requires: TIP-6 ``` ## Abstract -This is an alternative standard for storing metadata, but in a more familiar form for EVM users of such networks. It is not compatible with basic TYPE4.2 +This is an alternative standard for storing metadata, but in a more familiar form for EVM users of such networks. It is not compatible with basic Tip4.2 This standard proposes storing metadata outside the blockchain (centralized backing, ipfs, etc.) From 0443f5e4b9541f38c9cf84940c6cf0072cc23d67 Mon Sep 17 00:00:00 2001 From: Lisska Date: Fri, 7 Jun 2024 16:20:27 +0200 Subject: [PATCH 10/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index ee3427663..9a98598d5 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -154,7 +154,7 @@ The `attributes` field may not be present in the JSON metadata. "attributes": [ { "trait_type": "Base", - "value": "Starfish” + "value": "Starfish" }, { "trait_type": "Eyes", From 2bfeb0a1a5c545156e1b7535d34a9c7226327b8c Mon Sep 17 00:00:00 2001 From: Lisska Date: Mon, 12 Aug 2024 17:39:33 +0200 Subject: [PATCH 11/12] Update 2_2.md --- src/standard/TIP-4/2_2.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/standard/TIP-4/2_2.md b/src/standard/TIP-4/2_2.md index 9a98598d5..be5d80d64 100644 --- a/src/standard/TIP-4/2_2.md +++ b/src/standard/TIP-4/2_2.md @@ -41,10 +41,10 @@ interface ITIP4_2_2Collection { /// The TIP-6.1 identifier for this interface is 0x244a5200 /// @notice The event emits when set or change collection metadata - event collectionMetadataUpdated(); + event CollectionMetadataUpdated(); /// @notice The event emits when set or change NFTs metadata - event nftMetadataUpdated(); + event NftMetadataUpdated(); /// @notice build url to get metadata for NFT /// @return nftUrl - url to get metadata for NFT @@ -74,8 +74,8 @@ function getCollectionUrl() external view responsible returns (string collection The function is analogous to the getJson function in the Type4.2 standard but returns not json but a link to the json metadata of the collection. ```solidity -event collectionMetadataUpdated(); -event nftMetadataUpdated(); +event CollectionMetadataUpdated(); +event NftMetadataUpdated(); ``` You must emit them when you change the metadata of collection or NFT. @@ -93,7 +93,7 @@ interface ITIP4_2_2NFT { /// The TIP-6.1 identifier for this interface is 0x7239d7b1. /// @notice event emits when update NFT part. - event metadataUpdated(); + event MetadataUpdated(); /// @notice NFT part to get metadata /// @return part - TvmCell allows to build URL with metadata for this NFT @@ -108,7 +108,7 @@ function getUrlParts() external view responsible returns (TvmCell part); ``` The function returns the part identifying the NFT in the form of a TvmCell, which gives greater variability. In the simplest version, this could be id. -You must emit event `metadataUpdated()` when NFT part update. +You must emit event `MetadataUpdated()` when NFT part update. ### Metadata format JSON metadata type: "Basic NFT" From f6614702375ac29096a9a1259ba4f5bfff90e75f Mon Sep 17 00:00:00 2001 From: Lisska Date: Tue, 13 Aug 2024 14:30:59 +0200 Subject: [PATCH 12/12] Update and rename 2.md to 2_1.md --- src/standard/TIP-4/{2.md => 2_1.md} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/standard/TIP-4/{2.md => 2_1.md} (97%) diff --git a/src/standard/TIP-4/2.md b/src/standard/TIP-4/2_1.md similarity index 97% rename from src/standard/TIP-4/2.md rename to src/standard/TIP-4/2_1.md index 4e50af415..9cd7e0390 100644 --- a/src/standard/TIP-4/2.md +++ b/src/standard/TIP-4/2_1.md @@ -1,10 +1,10 @@ --- -title: 4.2. JSON Metadata +title: 4.2. On-chain JSON Metadata sidebar_position: 2 -slug: /standard/TIP-4.2 +slug: /standard/TIP-4.2.1 --- -# Non-Fungible Token JSON Metadata (TIP-4.2) +# Non-Fungible Token on-chain JSON Metadata (TIP-4.2.1) Requires: [TIP-6.1](./../TIP-6/1.md) @@ -26,7 +26,7 @@ The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL N Return the metadata as JSON -Every TIP4.2 compliant contract must implement the `TIP4_2JSON_Metadata` interface and [TIP-6.1](./../TIP-6/1.md) interfaces +Every TIP4.2.1 compliant contract must implement the `TIP4_2JSON_Metadata` interface and [TIP-6.1](./../TIP-6/1.md) interfaces ```solidity pragma ton-solidity >= 0.58.0; @@ -326,7 +326,7 @@ Sphere is described by coordinates of central point and radius. ## How to add the new JSON metadata type? -For added new metadata type of [TIP-4.2](2.md) +For added new metadata type of [TIP-4.2.1](2_1.md) - Create product that use new JSON type. - Send PR for change the docs.