|
|
|
@ -176,17 +176,17 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { |
|
|
|
|
address from, |
|
|
|
|
address to, |
|
|
|
|
uint256 tokenId, |
|
|
|
|
bytes memory _data |
|
|
|
|
bytes memory data |
|
|
|
|
) public virtual override { |
|
|
|
|
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); |
|
|
|
|
_safeTransfer(from, to, tokenId, _data); |
|
|
|
|
_safeTransfer(from, to, tokenId, data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @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. |
|
|
|
|
* |
|
|
|
|
* `_data` is additional data, it has no specified format and it is sent in call to `to`. |
|
|
|
|
* `data` is additional data, it has no specified format and it is sent in call to `to`. |
|
|
|
|
* |
|
|
|
|
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. |
|
|
|
|
* implement alternative mechanisms to perform token transfer, such as signature-based. |
|
|
|
@ -204,10 +204,10 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { |
|
|
|
|
address from, |
|
|
|
|
address to, |
|
|
|
|
uint256 tokenId, |
|
|
|
|
bytes memory _data |
|
|
|
|
bytes memory data |
|
|
|
|
) internal virtual { |
|
|
|
|
_transfer(from, to, tokenId); |
|
|
|
|
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); |
|
|
|
|
require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -256,11 +256,11 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { |
|
|
|
|
function _safeMint( |
|
|
|
|
address to, |
|
|
|
|
uint256 tokenId, |
|
|
|
|
bytes memory _data |
|
|
|
|
bytes memory data |
|
|
|
|
) internal virtual { |
|
|
|
|
_mint(to, tokenId); |
|
|
|
|
require( |
|
|
|
|
_checkOnERC721Received(address(0), to, tokenId, _data), |
|
|
|
|
_checkOnERC721Received(address(0), to, tokenId, data), |
|
|
|
|
"ERC721: transfer to non ERC721Receiver implementer" |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -382,17 +382,17 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { |
|
|
|
|
* @param from address representing the previous owner of the given token ID |
|
|
|
|
* @param to target address that will receive the tokens |
|
|
|
|
* @param tokenId uint256 ID of the token to be transferred |
|
|
|
|
* @param _data bytes optional data to send along with the call |
|
|
|
|
* @param data bytes optional data to send along with the call |
|
|
|
|
* @return bool whether the call correctly returned the expected magic value |
|
|
|
|
*/ |
|
|
|
|
function _checkOnERC721Received( |
|
|
|
|
address from, |
|
|
|
|
address to, |
|
|
|
|
uint256 tokenId, |
|
|
|
|
bytes memory _data |
|
|
|
|
bytes memory data |
|
|
|
|
) private returns (bool) { |
|
|
|
|
if (to.isContract()) { |
|
|
|
|
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { |
|
|
|
|
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { |
|
|
|
|
return retval == IERC721Receiver.onERC721Received.selector; |
|
|
|
|
} catch (bytes memory reason) { |
|
|
|
|
if (reason.length == 0) { |
|
|
|
|