0

I am trying to compile the example contract in https://ethereum.org/token and following along with the instructions.

The Ethereum wallet cannot compile it though. I get the following error message

 Expected ',' but got identifier
interface tokenRecipient { function receiveApproval(address _from, 
uint256 _value, address _token, bytes calldata _extraData) external; }

^--------^

First time trying to do a contract in Ethereum, and figured that the example code from the official Ethereum website should work. Can anyone tell me what is wrong?

0

This is because of the solidity version. If using solc@0.4.x then use

interface tokenRecipient { function receiveApproval(address _from, 
uint256 _value, address _token, bytes _extraData) external; }

Instead of

interface tokenRecipient { function receiveApproval(address _from, 
uint256 _value, address _token, bytes calldata _extraData) external; }

Or change the solidity version to solc@0.5.0

  • How do I change solidity version of Ethereum wallet? – user3207230 Apr 4 at 7:51
  • just remove the calldata and it will work fine – Hamza Ahmed Apr 4 at 11:52
0

Check your solidity compiler version.
The "calldata" is available 0.5.0 or higher

  • How do I change solidity version of Ethereum wallet? – user3207230 Apr 4 at 8:32

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.