-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new metadata standart for store NFT #370
Open
Lisska
wants to merge
12
commits into
everscale-org:main
Choose a base branch
from
Lisska:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+188
−5
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9329ca8
Create new metadata format 4_2_2
Lisska 4848b4a
Rename 2_2 to 2_2.md
Lisska f4ab585
Update 2_2.md
Lisska 06ce9fe
Update 2_2.md
Lisska ff7cdc1
Update 2_2.md
Lisska cfe3e7d
Update 2_2.md
Lisska 04eb40b
Update 2_2.md
Lisska 8712cdd
Update 2_2.md
Lisska 5a4a9c6
Update 2_2.md
Lisska 0443f5e
Update 2_2.md
Lisska 2bfeb0a
Update 2_2.md
Lisska f661470
Update and rename 2.md to 2_1.md
Lisska File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
--- | ||
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 <[email protected]>, Aleksandr Khramtsov <[email protected]> | ||
type: Contract | ||
created: 2024-06-07 | ||
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 Tip4.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 update NFT part. | ||
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. | ||
The `attributes` field may not be present in the JSON metadata. | ||
|
||
| 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 (Base, Eyes ...) | | | ||
| **attributes.value** | string || Value of attribute (Starfish, 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" | ||
} | ||
], | ||
"attributes": [ | ||
{ | ||
"trait_type": "Base", | ||
"value": "Starfish" | ||
}, | ||
{ | ||
"trait_type": "Eyes", | ||
"value": "blue" | ||
} ] | ||
"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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are adding a new On-chain JSON Metadata standard and attempting to replace the existing TIP-4.2 JSON Metadata, this is a standard; you can't just delete it, there are assets based on this standard that developers will need to work with, and you've decided to remove information about it, considering that the proposed changes are significant, the correct approach would be to add TIP-4.7 On-chain JSON Metadata
P.S. As for the broken build, check the build logs — all the answers are there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see https://github.com/everscale-org/docs/pull/370/checks#step:4:109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 Additionally, I kindly ask you to pay attention to the change history formation, there is a document that describes the process of making changes, it provides all the necessary instructions, if necessary, just squash the commits so that all these attempts to make the changes don't clutter up the main project history — there's no point in that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #13