ethereum/EIPs

EIP-1808: A Non-homogenous digital asset data sharing standard

ypenghui6 opened this issue · 2 comments


eip: 1808
title: ERC-1808 Token Standard
author: Ypenghui<ypenghui6@163.com>
status: Draft
type: Standards Track
category: ERC
created: 2019-08-14
requires: 165

Simple Summary

A Non-homogenous digital asset data sharing standard.

Abstract

Multiverse

Each blockchain game can be considered a game universe, and several game universes with similar basic settings can be considered to have a common multiverse.

1808

ERC-1808 Standard (hereinafter referred to as "1808 Standard") is a non-homogeneous digital assets data sharing standard that applied to decentralized distributed ledger network. As the perfect way to represent various non-fungible items, non-homogeneous digital assets can cover the field of game items, gears, characters, map data, and even expansion pack in the game industry. This manual also focus on the multiverse system based on 1808 Standard, such as universe traveling, multiverse, and etc.

Motivation

Combining the needs of gaming industry, we reviewed a number of existing non-homogeneous digital asset standards and defined ERC1808 to be the one to standardize all non-homogeneous digital assets data sharing.
At present, ERC-721, ERC-1155, and ERC-998 of Ethereum network are the popular non-homogeneous digital asset standards, which are used in different scenarios and for different needs on the Ethereum network:

  • ERC-721
    It is an officially accepted non-homogeneous digital asset standard defined by smart contracts in the Ethereum network. It has a customizable data zone, which makes it possible to digitize items or records.
    Typical applications are: Crypto Kitties, Crypto Celebrities, etc
  • ERC-1155
    It is a standard interface proposed by Enjin to define multiple non-homogenous assets in Ethereum's single smart contract, serving mainly the virtual props in blockchain games.
    Typical application: War of Crypto.
  • ERC-998
    It is a combination of non-homologous tokens (CNFT, Composable NFTs) defined in Ethereum's smart contracts proposed by Matt Lockyer.

Game items are a kind of non-homogeneous digital assets used in blockchain games. The process of items “travelling” across different universes is that of applying and changing of a non-homogeneous digital asset in different games and services under the same multiverse.

The 1808 Standard makes it possible for on-chain games to design the multiverse/parallel universes. Different game multiverses are also different game universes, which forms the multiverse of on-chain games. The game items in each universe can be freely circulated, and are written with different attributes, skills, etc. in different games. These items do not affect each other. This is what we mentioned as the item design in the "parallel universes".

Scalable custom data enables game designers to create unique game assets. Non-interfering zone data allows game assets to be given new properties that are an immune while "travelling" the universes and the multiverse, while also making it possible of data linkage between games (such as skill gain/reduction).

Specification

The key words “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.

Smart contracts implementing the ERC-1808 standard MUST implement all of the functions in the ERC1808 interface.

pragma solidity ^0.5.0;

/// @title ERC-1808 Non homogeneous assets standard 
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1808.md
interface IRCNFT {
    /// @dev This emits when a NFT is added.
    event AddNFT(address indexed addAddress, uint256 indexed nftId, string nftName);

    /// @dev This emits When the state of nft changes.
    event ChangeNFTState(address indexed businessAddress, uint256 indexed nftId, bool indexed state);

    /// @dev This emits When the extra attribute's count of nft changes.
    event ChangeNFTExtAttrCount(address indexed businessAddress, uint256 indexed nftId, uint256 indexed extAttrCount);

    /// @dev This emits When the extra attribute of token changes.
    event ChangeTokenExtAttr(address indexed businessAddress,uint256 indexed nftId, uint256 indexed tokenId, uint256 index, string extData );

    /// @dev This emits When the extra attributes of token changes.
    event ChangeTokenExtAttrs(address indexed businessAddress,uint256 indexed nftId, uint256 indexed tokenId, string[] extDatas );
        
    /// @notice add new nft.
    /// @dev  Throws if the length of `_nftName` less than zero.
    /// Throws if the length of `_nftName` is greater than 32.
    /// Throws unless an authorized operator of the current owner.
    /// @param _nftName The new nft name.
    /// @param _extAttrCount The NFT extra attribute's count.
    function addNFT(string memory _nftName, uint256 _extAttrCount) public;
    
    /// @notice set nft state.
    /// @dev  Throws if the `_state` equal to the nft state.
    /// Throws if the `_nftId` is valid.
    /// Throws unless an authorized operator of the current owner.
    /// @param `_nftId` The nft id.
    /// @param `_state` The nft state.
    function setNFTState(uint256 _nftId, bool _state) public;

    /// @notice set nft extra attribute's count.
    /// @dev  Throws if the `_extAttrCount` less than the nft extAttrCount.
    /// Throws if the `_nftId` is valid.
    /// Throws unless an authorized operator of the current owner.
    /// @param `_nftId` The nft id.
    /// @param `_extAttrCount` The NFT extra attribute's count.
    function setNFTExtAttrCount(uint256 _nftId, uint256 _extAttrCount) public;

    /// @notice get nfts info.
    /// @return nftIds, nftNames and flags
    function getNFTs() public view returns(uint256[] memory nftId,string[] memory nftName, bool[] memory flags);

    /// @notice get nft counts.
    /// @return the nft counts.
    function getNFTCount() public view returns(uint256);
    
    /// @notice get nft.
    /// @dev  Throws if the `_nftId` - 1 is greater than the nft array length.
    /// Throws if the `_nftId` less than 0.
    /// @param `_nftId` The nft id.
    /// @return the nft name and state.
    function getNFT(uint256 _nftId) public view returns(string memory nftName, bool state);

    /// @notice check the nft state.
    /// @dev  Throws if the `_nftId` - 1 is greater than the nft array length.
    /// Throws if the `_nftId` less than 0.
    /// @param `_nftId` The nft id.
    /// @return the nft state.
    function isEnableNFT(uint256 _nftId) public view returns(bool flag);

    /// @notice set the nft extra data.
    /// @dev  Throws if the `_nftId` - 1 is greater than the nft array length.
    /// Throws if the contract is paused.
    /// Throws if the `_nftId` is valid.
    /// Throws if the `_tokenId` is valid.
    /// Throws if the `_index` is greater than the nft extra attribute count.
    /// Throws if the nft extra data count less than 0.
    /// @param `_nftId` The nft id.
    /// @param `_tokenId` The token id.
    /// @param `_index` The array index.
    /// @param `_extData` The extra data.
    function setExtData(uint256 _nftId, uint256 _tokenId, uint256 _index, string memory _extData) public;

    /// @notice set the nft extra data.
    /// @dev  Throws if the `_nftId` - 1 is greater than the nft array length.
    /// Throws if the contract is paused.
    /// Throws if the `_nftId` is valid.
    /// Throws if the `_tokenId` is valid.
    /// Throws if the length of `_extDataArray` is greater than the nft extra attribute count.
    /// Throws if the length of `_extDataArray` less than 0.
    /// Throws if the nft extra data count less than 0.
    /// @param `_nftId` The nft id.
    /// @param `_tokenId` The token id.
    /// @param `_extDataArray` The array of extra data.
    function setExtData(uint256 _nftId, uint256 _tokenId, string[] memory _extDataArray) public;

    /// @notice get the nft extra data.
    /// @param `_nftId` The nft id.
    /// @param `_tokenId` The token id.
    /// @param `_index` The array index.
    /// @return the nft tokenAttr.
    function getExtData(uint256 _nftId, uint256 _tokenId, uint256 _index) public view  returns(string memory tokenAttr);

    /// @notice get all nft extra datas
    /// @dev  Throws if the `_nftId` is valid.
    /// Throws if the `_tokenId` is valid.
    /// Throws if the nft extra data count less than 0.
    /// @param `_nftId` The nft id.
    /// @param `_tokenId` The token id.
    /// @return the nft attributes.
    function getExtDatas(uint256 _nftId, uint256 _tokenId) public view isValidToken(_tokenId) isValidNFTId(_nftId) returns(string[] memory attrs);
}

Rationale

NFT Identifiers

Every NFT is identified by a struct of string nftName, uint256 extAttrCount and bool state; inside the ERC-1808 smart contract.

management mechanism

In order to organize different games under the same world view, we have established a simple management mechanism.

ERC-1808 standardizes a add function addNFT; a logic delete function setNFTState; some inquiry function getNFTs, getNFTCount, getNFT; and a option function isEnableNFT.

NFT data sharing mechanism

The game prop itself is a non-homogeneous digital asset whose characteristic data should remain unchanged. The process of proposing "traversing" the world line is the process of applying and changing a non-homogeneous digital asset in different games, business, and business under the same world view; it will inevitably involve data sharing and data update issues. We share other data by setting additional data for the current game.

ERC1808 standardizes a set of extra data functions setExtData, and the gets the extra data function getExtData or getExtDatas.

Backwards Compatibility

An implementation contracts must implement the ERC1808 interface.

Test Cases

ERC-1808 Token includes test cases written using Truffle.

Implementations

An implementation can be found here: https://github.com/Cocos-BCX/ERC-1808

References

Standards

  1. ERC-20 Token Standard. https://eips.ethereum.org/EIPS/eip-20
  2. ERC-165 Standard Interface Detection. https://eips.ethereum.org/EIPS/eip-165
  3. ERC-721 Non-Fungible Token Standard. https://eips.ethereum.org/EIPS/eip-721
  4. ERC-998 Composable Non-Fungible Token Standard. https://eips.ethereum.org/EIPS/eip-998
  5. ERC-1155 Multi Token Standard. https://eips.ethereum.org/EIPS/eip-1155

Copyright

Copyright and related rights waived via CC0.

There has been no activity on this issue for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

This issue was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment.