How does one have a capped crowdsale? This is my code so far

contract CrowdsaleToken is StandardToken{

 string public constant name = "TestCoin";
 string public constant symbol = "TCC";
 uint public constant decimals = 6;
 address public constant multisig = 0x0;

 uint public constant PRICE = 500;

 uint public maximumEther = 1;
    uint public totalEther;

    function () payable {
        // Do not accept payment if recaudation is above maximumEther
        if (totalEther >= maximumEther) throw;

        // Emit tokens
        totalEther = totalEther + msg.value;


  /*function () payable {

 function createTokens(address recipient) payable {
     if (msg.value == 0) {

     uint tokens = msg.value.mul(getPrice());
     totalSupply = totalSupply.add(tokens);

     balances[recipient] = balances[recipient].add(tokens);

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

     function getPrice() constant returns (uint result) {
         return PRICE;


I actually haven't tested it yet, and am going to soon. Just wanted to get feedback to see if any modifications should be made.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.