Go-ethereum: Crowdsale not compiling: problem with GoalReached

Created on 30 Sep 2017  路  11Comments  路  Source: ethereum/go-ethereum

System information

Geth version: geth version 1.7.0
OS & Version: Windows 10
Commit hash : (if develop)

Expected behaviour

Deploy the crowdsale contract in the Ethereum wallet. The code from: https://www.ethereum.org/crowdsale. The code is pragma solidity ^0.4.16.

Actual behaviour

It won't. It says: Could not compile source code. And then the error stated below this text. Does anybody know how to still deploy a crowdsale?

Backtrace

````
Could not compile source code.

This declaration shadows an existing declaration.
event GoalReached(address beneficiary, uint amountRaised);
^-----------------^
````

Most helpful comment

yep, here is the solution: just rename the two variables (address beneficiary, uint amountRaised); to different names, for example: (address _beneficiary, uint _amountRaised), and it'll compile fine.
The example code on the site needs to be updated by the maintainers of course.

All 11 comments

Geth has little to do with compiling smart contracts. The crowdsale contract is old and the solidity language and compiler has evolved quit a bit. So that is probably why you get these issues. When I copied the crowdsale contract into remix (remix.ethereum.org) it raises several warnings but no errors. I assume that the javascript solidity compiler that is loaded in Mist/wallet treats all warnings as errors or is an older version of browser solidity that contains a bug.

The best way to solve this is to ask the question in the Mist repo that can be found here https://github.com/ethereum/mist. Maybe they need to upgrade to the latest solidity version.

Same problem. It's not just the mist, but ethereum-wallet too. Using the latest version of EW and Gist.

This is a bit of a problem when the sample code provided won't compile. How the heck do I learn this correctly if the samples are faulty in Mist?

@fjl please reopen this issue. Same problem. Watch @wrisx comment.

@dansterling1 @Kowmung @gevglevskiy @dansterling1 @wrisx
Has anyone resolved this?
Used the same code from the ethereum website on the latest ethereum wallet and receiving same error.

yep, here is the solution: just rename the two variables (address beneficiary, uint amountRaised); to different names, for example: (address _beneficiary, uint _amountRaised), and it'll compile fine.
The example code on the site needs to be updated by the maintainers of course.

When I do the solution of wrisx it does work only it gives this error:
Identifier not found or not unique. event GoalReached(address_beneficiary, unit_amountRaised); ^-----------------^
How do I get past it?

You need a space before the dash:
address _beneficiary...

Then still:

Identifier not found or not unique.
    event GoalReached(address _beneficiary, unit _amountRaised);
                                            ^--^

Oww typo unint. Thanks

Still having issues with this.

mintToken.txt

Can someone help?

Thanks a lot in advance!

Was this page helpful?
0 / 5 - 0 ratings