4

This example returns syntax errors when the emit keyword is used.

emit AuctionEnded(highestBidder, highestBid);

This is the doc where the example code is.

http://solidity.readthedocs.io/en/develop/solidity-by-example.html#simple-open-auction

Why are there syntax errors? How do you really call an event in pragma solidity ^0.4.21;

1

2 Answers 2

4

You also need the correct version of the compiler. pragma solidity ^0.4.21 is only a hint, but not the selection of the concrete compiler.

If you try this at https://remix.ethereum.org/ which loads the 0.4.21 compiler by default, it will work perfectly fine. When you switch the compiler to a lower version (settings tab), you'll get the syntax error.

2
  • 1
    I see, the version was the key thanks! (note etherium.org not com)
    – jlansey
    Mar 7, 2018 at 20:38
  • oh.. my fault.. thanks for the pointer, changed it to org.
    – ivicaa
    Mar 7, 2018 at 20:40
3

update truffle

npm install [email protected] -g

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.