Add constant modifier to ERC721_RECEIVED magic value

This commit is contained in:
Santiago Palladino
2018-03-21 11:13:20 -03:00
parent 15f9556622
commit b33299569b
2 changed files with 6 additions and 4 deletions

View File

@ -13,8 +13,9 @@ contract ERC721BasicToken is ERC721Basic {
using SafeMath for uint256;
using AddressUtils for address;
// Equals to bytes4(keccak256("onERC721Received(address,uint256,bytes)"))
bytes4 ERC721_RECEIVED = 0xf0b9e5ba;
// Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
// which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
// Mapping from token ID to owner
mapping (uint256 => address) internal tokenOwner;

View File

@ -8,9 +8,10 @@ pragma solidity ^0.4.18;
contract ERC721Receiver {
/**
* @dev Magic value to be returned upon successful reception of an NFT
* Equals to bytes4(keccak256("onERC721Received(address,uint256,bytes)"))
* Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`,
* which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
*/
bytes4 ERC721_RECEIVED = 0xf0b9e5ba;
bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
/**
* @notice Handle the receipt of an NFT