0

Dear community members,

I have come across an error while defining an interface (just using the standard one interface ERC721TokenReceiver)

this interface is mentioned in this link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md

I was receving below error (Please find the screenshot) Data location must be "calldata" for parameter in external function, but none was given.enter image description here

the strange part was when I have changed bytes to bytes32 then error had gone. But I m in doubt

1) What was the reason for error

2) should i deviate from std guideline for defining the interface

Br Dev

1 Answer 1

1

bytes is an array of byte (like byte[], only easier on the eyes), so the second explicitness requirement listed here applies: https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html#explicitness-requirements

You can compile it, as is, with an earlier Solidity version. I found no issue with 0.4.20 and 0.4.25.

Alternatively, you can refactor the code slightly.

Change the first line to pragma solidity 0.5.2;, and at line 15, ... bytes calldata _data, .... That will work with a 0.5.2 compiler.

Hope it helps.

3
  • Thanks for your inputs,, I have gone through the documentation and added calldata as you have also mentioned and it worked .. Is there any reason for explicitly mentioning? Is there any low level changes being made at EVM level .. do u know any reading ref's to explore more
    – CaptPython
    Commented Jan 17, 2019 at 3:13
  • I'm not sure about all the rationale and viewpoints but my guess would be it's an effort to maintain consistency while also bringing some welcome changes. blog.b9lab.com/storage-pointers-in-solidity-7dcfaa536089 Commented Jan 17, 2019 at 3:28
  • Thanks for accepting tbe answer. Remember to vote often ;-) Commented Jan 17, 2019 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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