0

I have a function that looks like this:

function foo(uint _someVar, bytes calldata _data) public {
    ...
}

Then I make a call to it from another function with "" as _data:

foo(123, "");

"" seems to be the default way to pass blank bytes. However, I get this truffle compilation error:

TypeError: Invalid type for argument in function call. Invalid implicit conversion from literal_string "" to bytes calldata requested.

I have tried to declare and pass variables, but it all comes down to trying to assign blank calldata bytes. Any tips on how to do this?

New contributor
Danil is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • 1
    Use new bytes(0). – Ismael May 3 at 7:52

Your Answer

Danil is a new contributor. Be nice, and check out our Code of Conduct.

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

Browse other questions tagged or ask your own question.