The code below produces an error:


 function safeTransferFrom(
    address _from,
    address _to,
    uint256 _tokenId,
    bytes calldata _data
    _safeTransferFrom(_from, _to, _tokenId, _data);

The error is:

Invalid type for arguement in function call. Invalid implicit 
conversion from bytes calldata to bytes storage pointer requested.

It would be very helpful if someone could explain both the problem and the solution!

  • can you provide what is inside _safeTransferFrom ? – Achala Dissanayake Jul 31 at 9:13

That error will appear if you have declared the _data parameter of _safeTransferFrom as bytes storage. A way to fix it is to declare it as memory

  function _safeTransferFrom(
    address _from,
    address _to,
    uint256 _tokenId,
    bytes memory _data       // _data is declared as memory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.