Allow to query the approved contracts

This commit is contained in:
William Entriken 2018-02-25 23:27:38 -05:00 committed by GitHub
parent 3442342c5a
commit 2a56e50ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 17 deletions

View File

@ -39,33 +39,30 @@ Differences between this standard and EIP-20 are examined below.
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](https://www.ietf.org/rfc/rfc2119.txt). 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](https://www.ietf.org/rfc/rfc2119.txt).
The **baseline specification** is REQUIRED for all ERC-721 implementations (see "caveats", below). **Every ERC-721 compliant contract must implement the `ERC721` and [`ERC165`](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md) interfaces** (subject to "caveats" below):
```solidity ```solidity
pragma solidity ^0.4.20; pragma solidity ^0.4.20;
import "./ERC165.sol";
/// @title Required part of ERC-721 Deed Standard /// @title Required part of ERC-721 Deed Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md /// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 identifier for this interface is 0xb3a99827 /// Note: the ERC-165 identifier for this interface is 0xTODO_FILL_IN
interface ERC721 /* is ERC165 */ { interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any deed changes by any mechanism. /// @dev This emits when ownership of any deed changes by any mechanism.
/// This event emits when deeds are created (`from` == 0) and destroyed /// This event emits when deeds are created (`from` == 0) and destroyed
/// (`to` == 0). Exception: during contract creation, any number of deeds /// (`to` == 0). Exception: during contract creation, any number of deeds
/// may be created and assigned without emitting Transfer. At the time of /// may be created and assigned without emitting Transfer. At the time of
/// any transfer, the "approved deed controller" is implicitly reset to the /// any transfer, the approved address for that deed (if any) is reset to none.
/// zero address.
event Transfer(address indexed _from, address indexed _to, uint256 _deedId); event Transfer(address indexed _from, address indexed _to, uint256 _deedId);
/// @dev This emits when the "approved deed controller" for a deed is /// @dev This emits when the approved address for a single is changed or
/// changed or reaffirmed. The zero address indicates there is no approved /// reaffirmed. The zero address indicates there is no approved address.
/// deed controller. When a Transfer event emits, this also indicates the /// When a Transfer event emits, this also indicates that the approved
/// approved deed controller (if any) is reset to none. /// address for that deed (if any) is reset to none.
event Approval(address indexed _owner, address indexed _approved, uint256 _deedId); event Approval(address indexed _owner, address indexed _approved, uint256 _deedId);
/// @dev This emits when a third party ("operator") is enabled or disable for /// @dev This emits when an operator is enabled or disable for an owner.
/// an owner. The operator may manage all deeds of the owner. /// The operator may manage all deeds of the owner.
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/// @notice Count all deeds assigned to an owner /// @notice Count all deeds assigned to an owner
@ -104,8 +101,8 @@ interface ERC721 /* is ERC165 */ {
/// @param _deedId The deed to transfer /// @param _deedId The deed to transfer
function transferFrom(address _from, address _to, uint256 _deedId) external payable; function transferFrom(address _from, address _to, uint256 _deedId) external payable;
/// @notice Set or reaffirm the "approved deed controller" for a deed /// @notice Set or reaffirm the approved address for a deed
/// @dev The zero address indicates there is no approved deed controller. /// @dev The zero address indicates there is no approved address.
/// @dev Throws unless `msg.sender` is the current deed owner, or the /// @dev Throws unless `msg.sender` is the current deed owner, or the
/// "delegate operator" of the current deed owner. /// "delegate operator" of the current deed owner.
/// @param _approved The new approved deed controller /// @param _approved The new approved deed controller
@ -117,11 +114,23 @@ interface ERC721 /* is ERC165 */ {
/// @dev Emits the ApprovalForAll event /// @dev Emits the ApprovalForAll event
/// @param _operator Address to add to the set of authorized operators. /// @param _operator Address to add to the set of authorized operators.
/// @param _approved True if the operators is approved, false to revoke approval /// @param _approved True if the operators is approved, false to revoke approval
function setApprovalForAll(address _operateor, boolean _approved) payable; function setApprovalForAll(address _operateor, boolean _approved) external;
// CONFORMANCE TO ERC-165 ////////////////////////////////////////////////// /// @notice Get the approved address for a single deed
/// @dev Throws if `_deedId` is not a valid deed
/// @param _deedId The deed to find the approved address for
/// @return The approved address for this deed, or the zero address if there is none
function getApproved(uint256 _deedId) returns (address);
/// @notice Query if this implements an interface /// @notice Query if an address is an authorized operator for another address
/// @param _owner The address that owns the deeds
/// @param _operator The address that acts on behalf of the owner
/// @return True if `_operator` is an approved operator for `_owner`, false otherwise
function isApprovedForAll(address _owner, address _operator) returns (bool);
}
interface ERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165 /// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function /// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas. /// uses less than 30,000 gas.