Match IERC721 function order with EIP spec (#3287)

pull/3306/head
Jeff 3 years ago committed by GitHub
parent 668a648bc6
commit e7719ded56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 56
      contracts/token/ERC721/IERC721.sol

@ -38,6 +38,26 @@ interface IERC721 is IERC165 {
*/ */
function ownerOf(uint256 tokenId) external view returns (address owner); function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/** /**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked. * are aware of the ERC721 protocol to prevent tokens from being forever locked.
@ -93,15 +113,6 @@ interface IERC721 is IERC165 {
*/ */
function approve(address to, uint256 tokenId) external; function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/** /**
* @dev Approve or remove `operator` as an operator for the caller. * @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
@ -115,29 +126,18 @@ interface IERC721 is IERC165 {
function setApprovalForAll(address operator, bool _approved) external; function setApprovalForAll(address operator, bool _approved) external;
/** /**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * @dev Returns the account approved for `tokenId` token.
* *
* See {setApprovalForAll} * Requirements:
*
* - `tokenId` must exist.
*/ */
function isApprovedForAll(address owner, address operator) external view returns (bool); function getApproved(uint256 tokenId) external view returns (address operator);
/** /**
* @dev Safely transfers `tokenId` token from `from` to `to`. * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
* *
* Emits a {Transfer} event. * See {setApprovalForAll}
*/ */
function safeTransferFrom( function isApprovedForAll(address owner, address operator) external view returns (bool);
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
} }

Loading…
Cancel
Save