We are coding a contract that will work with ERC721 tokens, basically a Plasma Root Chain contract. We need this contract to do some work whenever it receives a new ERC721 token from a SafeTransferFrom
.
Just like the function() external payable
function is called only when ether is transferred to the contract, we would need the same functionality for ERC721, but we are not sure if it exists or is even possible to implement.
We know the function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) internal returns (bytes4)
is called whenever a SafeTransferFrom is done correctly, however, what can be done to stop anyone from just calling that function without actually depositing an ERC721 token?