Update ERC721 to latest 1.11.0 from OpenZeppelin-solidity (#11)
* Update ERC721 to latest 1.11.0 from OpenZeppelin-solidity * Hardcode supported interfaces instead of using lookup table. This avoids shifting storage when extending supports interface. * Update build artifacts * Fix linter errors
This commit is contained in:
committed by
GitHub
parent
8f4610e007
commit
c46f0353d1
20
contracts/introspection/ERC165.sol
Normal file
20
contracts/introspection/ERC165.sol
Normal file
@ -0,0 +1,20 @@
|
||||
pragma solidity ^0.4.21;
|
||||
|
||||
|
||||
/**
|
||||
* @title ERC165
|
||||
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
|
||||
*/
|
||||
interface ERC165 {
|
||||
|
||||
/**
|
||||
* @notice Query if a contract implements an interface
|
||||
* @param _interfaceId The interface identifier, as specified in ERC-165
|
||||
* @dev Interface identification is specified in ERC-165. This function
|
||||
* uses less than 30,000 gas.
|
||||
*/
|
||||
function supportsInterface(bytes4 _interfaceId)
|
||||
external
|
||||
view
|
||||
returns (bool);
|
||||
}
|
||||
32
contracts/introspection/ERC165Support.sol
Normal file
32
contracts/introspection/ERC165Support.sol
Normal file
@ -0,0 +1,32 @@
|
||||
pragma solidity ^0.4.21;
|
||||
|
||||
import "./ERC165.sol";
|
||||
|
||||
/**
|
||||
* @title ERC165Support
|
||||
* @dev Implements ERC165 returning true for ERC165 interface identifier
|
||||
*/
|
||||
contract ERC165Support is ERC165 {
|
||||
|
||||
bytes4 internal constant InterfaceId_ERC165 = 0x01ffc9a7;
|
||||
/**
|
||||
* 0x01ffc9a7 ===
|
||||
* bytes4(keccak256('supportsInterface(bytes4)'))
|
||||
*/
|
||||
|
||||
function supportsInterface(bytes4 _interfaceId)
|
||||
external
|
||||
view
|
||||
returns (bool)
|
||||
{
|
||||
return _supportsInterface(_interfaceId);
|
||||
}
|
||||
|
||||
function _supportsInterface(bytes4 _interfaceId)
|
||||
internal
|
||||
view
|
||||
returns (bool)
|
||||
{
|
||||
return _interfaceId == InterfaceId_ERC165;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user