I am following the truffle tutorial for creating a token.
I get this error when trying to compile the contract.
ParserError: Expected identifier, got 'LParen'
constructor () public {
^
Here is the code for the contract
pragma solidity ^0.4.24;
import "node_modules/openzeppelin/solidity/contracts/token/ERC20/StandardToken.sol";
contract AirtimeToken is StandardToken {
string public name = "AirtimeToken";
string public symbol = "AirTK";
uint8 public decimals = 18;
uint public INITIAL_SUPPLY = 12000;
constructor () public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
I tried passing in the properties as params in the constructor and got the same error
UPDATE:
link to StandardToken.sol
Best Answer
I had a similar problem. In my case, it was the system version of solc I had installed. Here's what I had. I had solc installed through Homebrew, and also truffle installed. When I run
truffle version
:So I had the latest version of truffle and, seemingly, solc as well. However, when I run
solc --version
:My system solidity version was different. I found that I had installed solidity through Homebrew (on Mac), so that was different from the version truffle was using. So the fix, in my case, was to upgrade solidity using homebrew. It upgraded from 0.4.19 to 0.4.24 and my problem went away. To upgrade solidity using Homebrew:
The first two lines are probably all you need if you already have solidity installed, but I added the rest for completeness.
While this was on Mac, the same issue might exist on Linux. Make sure you update the system installed version of solc, not just what's installed with truffle.