github.com/diadata-org/diadata@v1.4.593/config/nftContracts/erc721/erc721.sol (about)

     1  pragma solidity ^0.4.20;
     2  
     3  /// @title ERC-721 Non-Fungible Token Standard
     4  /// @dev See https://eips.ethereum.org/EIPS/eip-721
     5  ///  Note: the ERC-165 identifier for this interface is 0x80ac58cd.
     6  interface ERC721 /* is ERC165 */ {
     7      /// @dev This emits when ownership of any NFT changes by any mechanism.
     8      ///  This event emits when NFTs are created (`from` == 0) and destroyed
     9      ///  (`to` == 0). Exception: during contract creation, any number of NFTs
    10      ///  may be created and assigned without emitting Transfer. At the time of
    11      ///  any transfer, the approved address for that NFT (if any) is reset to none.
    12      event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
    13  
    14      /// @dev This emits when the approved address for an NFT is changed or
    15      ///  reaffirmed. The zero address indicates there is no approved address.
    16      ///  When a Transfer event emits, this also indicates that the approved
    17      ///  address for that NFT (if any) is reset to none.
    18      event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
    19  
    20      /// @dev This emits when an operator is enabled or disabled for an owner.
    21      ///  The operator can manage all NFTs of the owner.
    22      event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
    23  
    24      /// @notice Count all NFTs assigned to an owner
    25      /// @dev NFTs assigned to the zero address are considered invalid, and this
    26      ///  function throws for queries about the zero address.
    27      /// @param _owner An address for whom to query the balance
    28      /// @return The number of NFTs owned by `_owner`, possibly zero
    29      function balanceOf(address _owner) external view returns (uint256);
    30  
    31      /// @notice Find the owner of an NFT
    32      /// @dev NFTs assigned to zero address are considered invalid, and queries
    33      ///  about them do throw.
    34      /// @param _tokenId The identifier for an NFT
    35      /// @return The address of the owner of the NFT
    36      function ownerOf(uint256 _tokenId) external view returns (address);
    37  
    38      /// @notice Transfers the ownership of an NFT from one address to another address
    39      /// @dev Throws unless `msg.sender` is the current owner, an authorized
    40      ///  operator, or the approved address for this NFT. Throws if `_from` is
    41      ///  not the current owner. Throws if `_to` is the zero address. Throws if
    42      ///  `_tokenId` is not a valid NFT. When transfer is complete, this function
    43      ///  checks if `_to` is a smart contract (code size > 0). If so, it calls
    44      ///  `onERC721Received` on `_to` and throws if the return value is not
    45      ///  `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
    46      /// @param _from The current owner of the NFT
    47      /// @param _to The new owner
    48      /// @param _tokenId The NFT to transfer
    49      /// @param data Additional data with no specified format, sent in call to `_to`
    50      function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;
    51  
    52      /// @notice Transfers the ownership of an NFT from one address to another address
    53      /// @dev This works identically to the other function with an extra data parameter,
    54      ///  except this function just sets data to "".
    55      /// @param _from The current owner of the NFT
    56      /// @param _to The new owner
    57      /// @param _tokenId The NFT to transfer
    58      function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
    59  
    60      /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
    61      ///  TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
    62      ///  THEY MAY BE PERMANENTLY LOST
    63      /// @dev Throws unless `msg.sender` is the current owner, an authorized
    64      ///  operator, or the approved address for this NFT. Throws if `_from` is
    65      ///  not the current owner. Throws if `_to` is the zero address. Throws if
    66      ///  `_tokenId` is not a valid NFT.
    67      /// @param _from The current owner of the NFT
    68      /// @param _to The new owner
    69      /// @param _tokenId The NFT to transfer
    70      function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
    71  
    72      /// @notice Change or reaffirm the approved address for an NFT
    73      /// @dev The zero address indicates there is no approved address.
    74      ///  Throws unless `msg.sender` is the current NFT owner, or an authorized
    75      ///  operator of the current owner.
    76      /// @param _approved The new approved NFT controller
    77      /// @param _tokenId The NFT to approve
    78      function approve(address _approved, uint256 _tokenId) external payable;
    79  
    80      /// @notice Enable or disable approval for a third party ("operator") to manage
    81      ///  all of `msg.sender`'s assets
    82      /// @dev Emits the ApprovalForAll event. The contract MUST allow
    83      ///  multiple operators per owner.
    84      /// @param _operator Address to add to the set of authorized operators
    85      /// @param _approved True if the operator is approved, false to revoke approval
    86      function setApprovalForAll(address _operator, bool _approved) external;
    87  
    88      /// @notice Get the approved address for a single NFT
    89      /// @dev Throws if `_tokenId` is not a valid NFT.
    90      /// @param _tokenId The NFT to find the approved address for
    91      /// @return The approved address for this NFT, or the zero address if there is none
    92      function getApproved(uint256 _tokenId) external view returns (address);
    93  
    94      /// @notice Query if an address is an authorized operator for another address
    95      /// @param _owner The address that owns the NFTs
    96      /// @param _operator The address that acts on behalf of the owner
    97      /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
    98      function isApprovedForAll(address _owner, address _operator) external view returns (bool);
    99  }
   100  
   101  interface ERC721Metadata /* is ERC721 */ {
   102      /// @notice A descriptive name for a collection of NFTs in this contract
   103      function name() external view returns (string _name);
   104  
   105      /// @notice An abbreviated name for NFTs in this contract
   106      function symbol() external view returns (string _symbol);
   107  
   108      /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
   109      /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
   110      ///  3986. The URI may point to a JSON file that conforms to the "ERC721
   111      ///  Metadata JSON Schema".
   112      function tokenURI(uint256 _tokenId) external view returns (string);
   113  }
   114  
   115  interface ERC721Enumerable /* is ERC721 */ {
   116      /// @notice Count NFTs tracked by this contract
   117      /// @return A count of valid NFTs tracked by this contract, where each one of
   118      ///  them has an assigned and queryable owner not equal to the zero address
   119      function totalSupply() external view returns (uint256);
   120  
   121      /// @notice Enumerate valid NFTs
   122      /// @dev Throws if `_index` >= `totalSupply()`.
   123      /// @param _index A counter less than `totalSupply()`
   124      /// @return The token identifier for the `_index`th NFT,
   125      ///  (sort order not specified)
   126      function tokenByIndex(uint256 _index) external view returns (uint256);
   127  
   128      /// @notice Enumerate NFTs assigned to an owner
   129      /// @dev Throws if `_index` >= `balanceOf(_owner)` or if
   130      ///  `_owner` is the zero address, representing invalid NFTs.
   131      /// @param _owner An address where we are interested in NFTs owned by them
   132      /// @param _index A counter less than `balanceOf(_owner)`
   133      /// @return The token identifier for the `_index`th NFT assigned to `_owner`,
   134      ///   (sort order not specified)
   135      function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
   136  }
   137  
   138  /// for non-indexed tokenId params
   139  interface ERC721Compat {
   140      event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
   141  }