Browse Source

remove unnecessary internal constant (#1297)

Francisco Giordano 7 years ago
parent
commit
f28a135429

+ 1 - 1
contracts/token/ERC721/ERC721Holder.sol

@@ -13,6 +13,6 @@ contract ERC721Holder is IERC721Receiver {
     public
     public
     returns(bytes4)
     returns(bytes4)
   {
   {
-    return ERC721_RECEIVED;
+    return this.onERC721Received.selector;
   }
   }
 }
 }

+ 5 - 11
contracts/token/ERC721/IERC721Receiver.sol

@@ -7,20 +7,14 @@ pragma solidity ^0.4.24;
  * from ERC721 asset contracts.
  * from ERC721 asset contracts.
  */
  */
 contract IERC721Receiver {
 contract IERC721Receiver {
-  /**
-   * @dev Magic value to be returned upon successful reception of an NFT
-   *  Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
-   *  which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
-   */
-  bytes4 internal constant ERC721_RECEIVED = 0x150b7a02;
-
   /**
   /**
    * @notice Handle the receipt of an NFT
    * @notice Handle the receipt of an NFT
    * @dev The ERC721 smart contract calls this function on the recipient
    * @dev The ERC721 smart contract calls this function on the recipient
-   * after a `safetransfer`. This function MAY throw to revert and reject the
-   * transfer. Return of other than the magic value MUST result in the
-   * transaction being reverted.
-   * Note: the contract address is always the message sender.
+   * after a `safeTransfer`. This function MUST return the function selector,
+   * otherwise the caller will revert the transaction. The selector to be
+   * returned can be obtained as `this.onERC721Received.selector`. This
+   * function MAY throw to revert and reject the transfer.
+   * Note: the ERC721 contract address is always the message sender.
    * @param _operator The address which called `safeTransferFrom` function
    * @param _operator The address which called `safeTransferFrom` function
    * @param _from The address which previously owned the token
    * @param _from The address which previously owned the token
    * @param _tokenId The NFT identifier which is being transferred
    * @param _tokenId The NFT identifier which is being transferred