1

I followed the instructions and got an error:

Parse Error Expected Token ; got 'LParen' emit Transfer(msg.sender, _to_value);

How do I fix this?

Code:

function transfer(address _to, uint256 _value) public returns (bool success) { 
    require(balances[msg.sender] >= _value); 
    balances[msg.sender] -= _value; 
    balances[_to] += _value; 
    emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars return true; 
}
  • From this video link youtube.com/watch?v=d5EipPVafsA – Zach Jonesmay Jun 4 '18 at 6:51
  • The error is on line 43. The code is below – Zach Jonesmay Jun 4 '18 at 6:54
  • function transfer(address _to, uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars return true; } – Zach Jonesmay Jun 4 '18 at 6:56
  • The error is here emit Transfer(msg.sender, _to, _value); – Zach Jonesmay Jun 4 '18 at 6:56
  • 1
    Please add your whole code to the question with proper formatting. I suspect you're using an old compiler version which does not yet support the emit keyword – Lauri Peltonen Jun 4 '18 at 6:58
1

If I copypaste the EIP20.sol and EIP20Interface.sol from the provided ConsenSys github to Remix (in the same file) it compiles just fine. Also I doubt ConsenSys would release code that doesn't even compile.

I suspect your problem is somewhere else. Maybe you accidentally modified your code somehow?

If you're saying that the error is in the Transfer line, then my guess is that your are using too old compiler which doesn't yet have the emit keyword for events. It's included in versions starting from 0.4.21.

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.