0

Please see here, line 13 is not compiling in Mist. Can anyone help me understand what is going wrong?

You can see that it worked, obviously, for Etheroll when they performed their ICO.

https://etherscan.io/address/0xa9a8108994bb704261567e53b49607a73876ddf1#code

I have made some mods to the code, but even if you directly copy and paste the original from that etherscan link above into remix, you will see that it fails to compile.

What is going wrong here?

  • You forget to include the error you were getting with Mist or Remix. Perhaps Etheroll contracts use something that is now deprecated by the new version solidity compiler. – Ismael Jul 27 '17 at 3:54
1

I tried the exact code present in the link you provided in Remix and it got compiled successfully.

Although there were three warnings in token contract (Unused local variable for:

bool success

address _receiver and

uint _amount).

This is because it is not passed and returned in the function transfer but the body of the this function is empty so not using any of these variables.

function transfer(address _receiver, uint _amount) returns (bool success) { }

Can you share the error you are getting during compilation?

|improve this answer|||||
  • What I'm getting is a "local variable unused" error on line 13 which is preventing this source code from compiling into bytecode in Mist. However, if I try to deploy using MEW, rather than Mist, I don't get the nice gui to pop up asking what my inputs are for the various parameters of the contract, which is making it a pain to code. Any idea of how I can resolve this line 13 error in Mist? Or get that gui to come up in MEW? – DonationEfficiencyMitch Jul 28 '17 at 3:50
  • What Mist version you are using? Code should compile in case of warnings. For GUI, you can use online browser Remix (remix.ethereum.org) – Abhishek Jul 28 '17 at 4:39
  • 0.9.0 What about you? If this code is compiling in Mist for you, and bringing up a menu to input parameters, then that is what I need. Remix doesn't put up that menu to input the various parameters needed by the contract. – DonationEfficiencyMitch Jul 28 '17 at 5:17
  • I tested at 0.8.7 and it works. This is a warning not an error. Try to use the three unused variable in transfer function as below or add your own logic to avoid the warning. After this warning should not appear and should compile: function transfer(address _receiver, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) { balances[msg.sender] -= _amount; balances[_to] += _amount; return true; } else { return false; } } – Abhishek Jul 28 '17 at 5:46
  • Thanks, I'll try that then. You might want to wait before switching to 0.9.0. – DonationEfficiencyMitch Jul 28 '17 at 5:50
0

When I tried to compile the Etheroll code in Mist I got the error "throw" is deprecated in favour of "revert()", "require()" and "assert()". To fix this see my answer to this question:

You need to replace each line that says if(condition) throw; with require(opposite of condition);. For example:

if (_to == 0x0) throw;

becomes

require(_to != 0x0);

throw is used a number of times throughout your code, you need to change every one

|improve this answer|||||

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.