judging by that error, it seems _safeTransferFrom
has a signature that includes something along the lines of (bytes storage _data)
.
When you pass in bytes
that you've allocated to calldata
, and then pass it in as an argument to a function that expects a pointer to storage, you're doing something that the solidity compiler refuses to handle for you (and would be inefficient even if it did, honestly): it won't take the argument, write it to calldata, and then copy that argument over to storage for you silently in order to pass in the proper storage pointer to the function you then call with the data.
But hey: if it has to be in storage anyways, no reason to allocate it to both locations.
Solidity is funny about calldata
in this way, but it will implicitly copy from memory
to storage, as per the other answer. But you'd probably get the best gas savings by just declaring the argument in your function as storage
, actually, as opposed to memory
(as suggested in other answer, which compiler will copy for you) or calldata (as you're attempting here, and compiler refuses to handle).
_safeTransferFrom
?