I have a quick question. What line of code do i need to add or remove here

function Crowdsale(
        address ifSuccessfulSendTo,
        uint fundingGoalInEthers,
        uint durationInMinutes,
        uint etherCostOfEachToken,
        token addressOfTokenUsedAsReward
    ) {
        beneficiary = ifSuccessfulSendTo;
        fundingGoal = fundingGoalInEthers * 1 ether;
        deadline = now + durationInMinutes * 1 minutes;
        price = etherCostOfEachToken * 1 ether;
        tokenReward = token(addressOfTokenUsedAsReward);

To make the Ether cost of each token where 1 ether gives you 2,500 token?

2 Answers 2


Looking at your code,

uint etherCostOfEachToken

seems to be the price you are passing for each token in ether. For 1 ether to give 2500 token,your price needs to be

1 ether/2500 = 0.0004 ether for each token

Since solidity cannot handle decimal values right now, you need to set price as 0.0004*10^18 or 4e14(you can use scientific notation in since solidity version 0.4.10)


Instead of price = etherCostOfEachToken * 1 ether;
try price = etherCostOfEachToken * 400 szabo; and give 1 as input for "ether cost for each token" parameter in interface.

By the way, I used https://converter.murkin.me/ for ether conversions.

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.