Make IERC721 contracts interfaces instead (#2113)

* Make IERC721 contracts interfaces instead

* Bump minimum compiler version for IERC721
pull/2135/head
Nicolás Venturo 5 years ago committed by GitHub
parent f1db30955d
commit eb34ae67ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      contracts/token/ERC721/IERC721.sol
  2. 10
      contracts/token/ERC721/IERC721Enumerable.sol
  3. 10
      contracts/token/ERC721/IERC721Metadata.sol

@ -1,11 +1,11 @@
pragma solidity ^0.6.0; pragma solidity ^0.6.2;
import "../../introspection/IERC165.sol"; import "../../introspection/IERC165.sol";
/** /**
* @dev Required interface of an ERC721 compliant contract. * @dev Required interface of an ERC721 compliant contract.
*/ */
abstract contract IERC721 is IERC165 { interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved); event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
@ -13,12 +13,12 @@ abstract contract IERC721 is IERC165 {
/** /**
* @dev Returns the number of NFTs in `owner`'s account. * @dev Returns the number of NFTs in `owner`'s account.
*/ */
function balanceOf(address owner) public view virtual returns (uint256 balance); function balanceOf(address owner) external view returns (uint256 balance);
/** /**
* @dev Returns the owner of the NFT specified by `tokenId`. * @dev Returns the owner of the NFT specified by `tokenId`.
*/ */
function ownerOf(uint256 tokenId) public view virtual returns (address owner); function ownerOf(uint256 tokenId) external view returns (address owner);
/** /**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
@ -32,7 +32,7 @@ abstract contract IERC721 is IERC165 {
* - If the caller is not `from`, it must be have been allowed to move this * - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}. * NFT by either {approve} or {setApprovalForAll}.
*/ */
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual; function safeTransferFrom(address from, address to, uint256 tokenId) external;
/** /**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`). * another (`to`).
@ -41,13 +41,13 @@ abstract contract IERC721 is IERC165 {
* - If the caller is not `from`, it must be approved to move this NFT by * - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}. * either {approve} or {setApprovalForAll}.
*/ */
function transferFrom(address from, address to, uint256 tokenId) public virtual; function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) public virtual; function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) public view virtual returns (address operator); function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public virtual; function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) public view virtual returns (bool); function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual; function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
} }

@ -1,4 +1,4 @@
pragma solidity ^0.6.0; pragma solidity ^0.6.2;
import "./IERC721.sol"; import "./IERC721.sol";
@ -6,9 +6,9 @@ import "./IERC721.sol";
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721 * @dev See https://eips.ethereum.org/EIPS/eip-721
*/ */
abstract contract IERC721Enumerable is IERC721 { interface IERC721Enumerable is IERC721 {
function totalSupply() public view virtual returns (uint256); function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256 tokenId); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) public view virtual returns (uint256); function tokenByIndex(uint256 index) external view returns (uint256);
} }

@ -1,4 +1,4 @@
pragma solidity ^0.6.0; pragma solidity ^0.6.2;
import "./IERC721.sol"; import "./IERC721.sol";
@ -6,8 +6,8 @@ import "./IERC721.sol";
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721 * @dev See https://eips.ethereum.org/EIPS/eip-721
*/ */
abstract contract IERC721Metadata is IERC721 { interface IERC721Metadata is IERC721 {
function name() external view virtual returns (string memory); function name() external view returns (string memory);
function symbol() external view virtual returns (string memory); function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view virtual returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory);
} }

Loading…
Cancel
Save