ARC-721

1 ARC-721 Protocol Standard

ARC-721 is a set of standard interfaces, for issuing non-fungible tokens(NFT) on the AIXChain network. ARC-721 is fully compatible with ERC-721.

1.1 ARC-721 Smart Contract Interface Implementation

Every ARC-721 compliant contract must implement the ARC721 and ARC165 interfaces. Other extension interfaces can be implemented according to specific business requirements.

1.1.1 ARC-721 & ARC-165 Interfaces

pragma solidity ^0.4.20;

  interface ARC721 {
    // Returns the number of NFTs owned by the given account
    function balanceOf(address _owner) external view returns (uint256);

    //Returns the owner of the given NFT
    function ownerOf(uint256 _tokenId) external view returns (address);

    //Transfer ownership of NFT
    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;

    //Transfer ownership of NFT
    function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;

    //Transfer ownership of NFT
    function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

    //Grants address ‘_approved’ the authorization of the NFT ‘_tokenId’
    function approve(address _approved, uint256 _tokenId) external payable;

    //Grant/recover all NFTs’ authorization of the ‘_operator’
    function setApprovalForAll(address _operator, bool _approved) external;

    //Query the authorized address of NFT
    function getApproved(uint256 _tokenId) external view returns (address);

    //Query whether the ‘_operator’ is the authorized address of the ‘_owner’
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);

    //The successful ‘transferFrom’ and ‘safeTransferFrom’ will trigger the ‘Transfer’ Event
    event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);

    //The successful ‘Approval’ will trigger the ‘Approval’ event
    event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);

    //The successful ‘setApprovalForAll’ will trigger the ‘ApprovalForAll’ event
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

  }

  interface ARC165 {
      //Query whether the interface ‘interfaceID’  is supported
      function supportsInterface(bytes4 interfaceID) external view returns (bool);
  }

A wallet/broker/auction application MUST implement the wallet interface if it will accept safe transfers.

Solidity

The hash of bytes4(keccak256("onWRC721Received(address,address,uint256,bytes))) is different from the Ethereum version bytes4(keccak256("onERC721Received(address,address,uint256,bytes))). Please use 0x5175f878 instead of 0x150b7a02.

1.1.2 OPTIONAL Metadata Extension Interface

The metadata extension is OPTIONAL for ARC-721 smart contracts. This allows your smart contract to be interrogated for its name and for details about the assets which your NFTs represent.

Solidity

URI is a URI link describing the _tokenId asset, pointing to a JSON file that conforms to the ARC721 metadata description structure. When tokens are minted, each token needs to be assigned a unique URI:

JSON

1.1.3 OPTIONAL Enumeration Extension Interface

The enumeration extension is OPTIONAL for ARC-721 smart contracts. This allows your contract to publish its full list of NFTs and make them discoverable.

Solidity

Last updated