2

I am kinda new to Solidity.

kindly shed light in below issues:

  1. How to properly enter token quantity in Initial Supply (in this formula) , say it is 10 million

    contract MyCoin is StandardToken {
      string public name = "TOKKA";
      string public symbol = "TOK";
      uint256 public decimals = 18;
    
      uint256 constant INITIAL_SUPPLY = 1234 * 10**18;
    
      function StandardToken() public {
        balance[msg.sender] = INITIAL_SUPPLY;
      }
    }
    
  2. In case of non mintable tokens, why we have mintable term here:

      // creates the token to be sold.
      // override this method to have crowdsale of a specific mintable token.
      function createTokenContract() internal returns (StandardToken) {
          return new MyCoin();
      }
    
  3. How do you call createContract here? Where it is located?

    address public token;  // <---- contract used in the crowdsale
    
    function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public {
        require(_startTime >= now);
        require(_endTime >= _startTime);
        require(_rate > 0);
        require(_wallet != address(0));
    
        startTime = _startTime;
        endTime = _endTime;
        rate = _rate;
        wallet = _wallet;
        token = createTokenContract();
    }
    

    About RUN section of Remix:

  4. InjectedWeb3 - why usually the Address line is empty?

  5. Gas limit - do I need to modify it? If I put 150.000 then all contributors must pay this gas?
  6. Value - wei: what and why I put? sth there?
2

1: It should be 10 million multiplied by the decimals, so:

uint256 constant INITIAL_SUPPLY = 10000000 * 10** uint(decimals);

2: It is unrelated to whether or not the tokens are mintable. The crowdsale contract will deploy a new token contract which -according to your MyCoin definition- sets the initial supply to whatever you defined and assigns that to the creator. IMPORTANT: Notice you are not setting the totalSupply...

3: It is being called by the crowdsale contract's constructor. Deploying the crowdsale will call this function which will create a token contract and assign the crowdsale's token variable to it.

4: If you are using Metamask it shouldn't be empty, it will read the account you have unlocked with Metamask.

5: Not relevant. That is a local thing on Remix allowing you to increase the gas limit.

6: used if you want to execute a payable function and send ether to it.

Not my intention to disrespect you, but given the questions you are asking, I recommend you do some reasearch before trying to deploy an actual crowdsale / token on the mainnet. :)

  • Pablo, thanks for feedback. 3. can you kindly show this part the way it should be? where and what exactly I should provide in here? this is the only part where Remix gives ParserError (indicating 'contract') 4. ok i will try. 5 and 6: as i understand I dont touch them, right? – Buzzmuzz5 Dec 16 '17 at 1:03
  • There must be a problem with the constructor parameters you are supplying. Look at the first 4 require lines. They state what you should be passing as parameters. – pabloruiz55 Dec 16 '17 at 1:07

Your Answer

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

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