0

When attempting to compile any solidity contract, errors are returned. I find myself constantly having to restart the wallet as it gets stuck on both chains, on the test chain it got to the last block and i restarted the wallet and everything seemed to be fine, but contracts must be modified before they will work. For example, I had to remove this code from the create a crypto currency contract code:

function burn() payable returns (bool success) {
    if (balanceOf[_from] < _value) throw;                 // Check if the sender has enough
    balanceOf[_from] -= _value;                          // Subtract from the sender
    Burn(_from, _value);
    return true;
}

function burnFrom(address _from) payable returns (bool success) {
    if (balanceOf[_from] < _value) throw;                 // Check if the sender has enough
    if (_value > allowance[_from][msg.sender]) throw;   // Check allowance
    balanceOf[_from] -= _value;                          // Subtract from the sender
    Burn(_from, _value);
    return true;
}    

If I do not delete this code, the contract will not deploy.

I thought the issue was affecting just Debian, but it's happening on Ubuntu as well. Strangely enough on Debian, transactions were disappearing, though that's not happening here on Ubuntu, I'm wondering why this is happening.

  • what errors are being returned? – Travis Jacobs May 18 '17 at 13:29
  • Could not compile source code. Undeclared identifier. if (balanceOf[_from] < _value) throw; // Check if the sender has enough ^---^ , – Flower May 18 '17 at 14:24
1

The signature of your burnFrom function only specifies one parameter, _from. You need to change it to:

function burnFrom(address _from, uint256 _value) payable returns (bool success)

EDIT: This answer is only true if you're expecting the value as a param

  • This didn't work either (see comment below) – Flower May 22 '17 at 2:15
  • Operator < not compatible with types uint256 and int256 if (balanceOf[_from] < _value) throw; // Check if the sender has enough ^-----------------------^ , – Flower May 22 '17 at 2:16
  • Sorry for the late reply. I edited my answer - it's not int, it's uint. – jmontineri May 24 '17 at 3:55

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.