for my test project we just built up a crowdsale, everything was ok, we tried to send some eth, got some token for it, everything was ok, then we reached the goal, so contributors got paid. But after the crowdsale there was still like 80% of the token on the Crowdsale.

The Crowdsale contract sent back the ethereum to the beneficiary adress, but didnt sent back the tokens, so we just lost the tokens ? Like if it was burnt ?

Isn't it supposed to send back also unsold tokens ?

1 Answer 1


No contract returns ethers/tokens automatically, you have to program something in the contract to do it.

It depends on your crowdsale implementation. At the crowsale finalization to return ethers you execute a transfer


Assuming the crowdsale contract has ownership of the unassigned tokens you have to execute a transfer to return remaining tokens

uint remaining = token.balanceOf(this);
token.transfer(owner, remaining);

You can change owner for the destination address, and token is the crowdsale token.

  • So you mean that basicly it always refund token or no ? I'm not sure, coz the first line you say " it returns " and then " you h ave to put this in code " :/ Commented Oct 9, 2017 at 23:12
  • @LumekaKalume Which contracts are you using? Without knowing your contracts it is impossible to tell. Every contract is different, some contracts have refunding of tokens, others do not.
    – Ismael
    Commented Oct 10, 2017 at 0:55
  • I just took the basic one from the ethereum crowdsale part to be honest, is there any place where i can find prebuilt contract, any library or whatever ? I'm just a webdev, so all of this is a bit new to me. I ty my best, if you just want to tell me where i can get the information and do it by myself i'm ok with. I'm not lazy, just i'm really not confortable wi th it but want to do it as clean as possible :) Commented Oct 10, 2017 at 10:35
  • This is the one i'm using ethereum.org/crowdsale Commented Oct 10, 2017 at 10:36
  • 1
    That is a demo of Ethereum capabilities used for learning solidity, I'd not use that contract in production. I'd recommend to try a more complete and battle tested contracts like those of OpenZeppelin, or TokenMarket.
    – Ismael
    Commented Oct 10, 2017 at 14:26

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.