Conflux tree diagram blockchain "digital collection" contract standards and writing specifications

6a5815a9f1d9a149417774f89b18a0ff.gif

The Conflux treemap chain is booming, especially related applications such as "digital collections" are springing up like mushrooms after a rain. But what follows is a mixed bag of contract quality and standards compatibility.

"Digital collections" are "collections" issued on the blockchain that have a certain cultural background, artistic value or collection value. They need to be distinguished from ordinary non-fungible tokens (NFT), and the relevant interfaces need to be more standardized and standardized. .

For the prosperity and sustainable development of "digital collections" applications on the entire Conflux tree diagram chain, for the convenience of integration between applications, and to ensure the quality and security of the contract, we have compiled the "Digital Collections" Contract Standards and Writing Specifications, please all "Digital Collection" developers must read this article carefully and follow the following standards and specifications. If a contract does not meet the following standards and writing specifications, it cannot be called a "digital collection" on the Conflux tree diagram chain.

1. Follow the OpenZeppelin standard

OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts) provides a community-vetted smart contract library that includes ERC 721 (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master /contracts/token/ERC721/ERC721.sol) and ERC 1155 (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol) implementation.

Before deploying to the Conflux chain, please ensure that your contract at least contains all the contents of any of the above implementations. For the implementation of other non-OpenZeppelin ERC 721 and ERC 1155 contract standards, it is necessary to ensure that the externally exposed interface name is consistent with the OpenZeppelin implementation.

The name and symbol attributes are required in the contract, otherwise the NFT information cannot be fully displayed on ConfluxScan and third-party applications.

2. Non-homogeneity

At all times  , you must ensure that the "digital collections" issued by your contract are non- homogeneous : each tokenId only corresponds to one "digital collection", and there cannot be multiple copies under one tokenId.

Priority is given to using the ERC 721 standard, which is sufficient for most situations.

If you want to use the ERC 1155 standard, please be sure to ensure that one tokenId corresponds to one "digital collection" to avoid users' doubts about the value of the "digital collection".

3. Use enumeration functions

The role of the enumeration interface emphasizes "decentralized" display of data. Using the enumeration function can facilitate third-party applications (ConfluxScan and wallets, etc.) to query the NFT information saved by your deployed contract. Otherwise, there is no guarantee that your NFT can be displayed correctly by ConfluxScan and wallet. All CRC-721 contracts must contain all enumeration functions in the following contracts:

  • ERC721Enumerable: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721Enumerable.sol

  • CRC721Enumerable: https://github.com/conflux-fans/conflux-contracts/blob/main/contracts/token/CRC721/extensions/CRC721Enumerable.sol

All CRC-1155 contracts must contain all enumeration functions in the following contracts:

  • CRC1155Enumerable: https://github.com/conflux-fans/conflux-contracts/blob/main/contracts/token/CRC1155/extensions/CRC1155Enumerable.sol

For more enumeration related content, please refer to: https://conflux-technical-support.gitbook.io/conflux-nft-kai-fa-zhi-nan/he-yue-mei-ju-han-shu-shuo-ming /mei-ju-kuo-zhan-enumeration-extension

4. Set up payment contract

Conflux's payment mechanism uses a sponsorship mechanism to subsidize users' use of smart contracts. By introducing a built-in payment contract, interacting with sponsored contracts will not require CFX to pay gas bills, allowing new accounts with zero balances. Smart contracts can also be called.

Therefore, please be sure to introduce a payment contract into your contract and set up gas fee payment to ensure that any user interacting with your contract can be sponsored by the payment mechanism without spending CFX. In the current environment, this is very important for your NFT Application compliance is important. Sample project contract NFT 1.0 and 2.0 are configured with proxy payment by default. You can apply at https://confluxscan.net/sponsor after deployment.

If the project party would like help setting up proxy payment, please contact : [email protected]

For details on the payment mechanism, please see:

  • Detailed explanation of the payment mechanism in Conflux: https://forum.conflux.fun/t/conflux/11949

  • Set up Sponsor for the contract: https://forum.conflux.fun/t/sponsor/13014

5. Contract verification

After deploying the contract to the mainnet, be sure to verify it on ConfluxScan.

After contract verification, there will be the following benefits:

  1. After contract verification, you can see the Solidity source code and ABI on Scan, which is more transparent and everyone can review the contract logic.

  2. The verified contract can directly call the contract method on the Scan contract details page to read the contract status, or update the contract status through the Fluent link.

  3. After the contract is verified, Scan will display the green ✅ logo, making users feel more at ease.

How to verify the contract please refer to:

  • Interact with the contract:

    https://conflux-technical-support.gitbook.io/conflux-nft-kai-fa-zhi-nan/step-1-ren-shi-confluxscan/yu-he-yue-jiao-hu#ru-he-yan-zheng-he-yue

  • ConfluxScan verifies the contract: https://wiki.conflux123.xyz/books/tutorials/page/confluxscan

TO BE CONTINUED

This specification is being continuously updated. For more information, please click "Read the original text" below.

6393307fa4f4c5fa86f41e2694f88859.gif

Guess you like

Origin blog.csdn.net/weixin_44282220/article/details/125734384