We're creating a crowdsale smart contract on ethreum and would like to know the code to modify the crowdsale such that when a token is bought, it also sends the same quantity of tokens to the founder's account so that they always control 50% of the project.

1 Answer 1


Assuming that your solution is similar to open-zepellin crowdsale contract you need to add a single line that will mint tokens to the founder account:

function buyTokens(address beneficiary) payable {
    require(beneficiary != 0x0);

    uint256 weiAmount = msg.value;
    uint256 updatedWeiRaised = weiRaised.add(weiAmount);

    // calculate token amount to be created
    uint256 tokens = weiAmount.mul(rate);

    // update state
    weiRaised = updatedWeiRaised;

    token.mint(beneficiary, tokens);

    //Mint as well to the founder's account
    token.mint(founder, tokens);

    TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);


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.