Hello, I've been trying to implement IERC721Receiver.sol and it seems like I can't really find a reason why we need to have it, or import it at all.
The following code(s) return successful for _safeMint function on ERC721 contract.
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) public pure returns (bytes4) {
return 0x150b7a02;
}
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) public pure returns (bytes4) {
return this.onERC721Received.selector;
}
contract x is IERC721Receiver {
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) public override returns (bytes4) {
return this.onERC721Received.selector;
}
}
heck, if it wasn't for the caller function in ERC721.sol, even this would work!
function onERC721Received() public pure returns (bytes4) { return 0x150b7a02; }
why do we have to go through all the hassle of importing this contract, inheriting it, and then adding a function that does not even use the variables besides to accept it from the erc721 contract, when in reality the whole point is just to return a FIXED value?