I'm having a precrowdsale and a crowdsale, How can I send the ether from the first to the second once the precrowdsale is over? this is the script I have:

//send to crowdsale


//sending is successful

} else {

// sending failed } }

but Ethereum Wallet compiler says: Could not compile source code.

Expected import directive or contract definition. if(receiver_address.send(amount_in_Wei)){ ^

What's wrong? Thank you!!!!


2 Answers 2


Take a look here, at the end of the file:

   * Set the target crowdsale where we will move presale funds when the crowdsale opens.
  function setCrowdsale(Crowdsale _crowdsale) public onlyOwner {
     crowdsale = _crowdsale;

I'm using a code like this:

if (!wallet.send(msg.value)) {

and it compiles without errors. Are you using a pragma?

pragma solidity ^0.4.11;

Try using it at the very first line of code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.