I am doing a test ICO on rinkeby testnet and the structure I am planning will be:

  1. Deployed Token contract
  2. Deployed ICO contract
  3. ICO contract is the owner of the Token contract
  4. I am the owner of the ICO contract
  5. When the test user will send ether to ICO contract, ICO contract will trigger a function and send the test investor tokens from the Token contract.

The problem I am facing is that I don't know how to make the TOKEN contract the owner of the totalSupply tokens. What should the exact line of code be?

balance[X] = totalSupply; where X is deployed contract address? What should i write instead of X to make deployed contract the owner of all tokens?

2 Answers 2


If your token is ERC20 (i assume?) and i correctly understood the question, then you can just mint it similar as described here


You could do it in your deployment I guess by deploying the ICO contract first, then passing the address in to your token contract as the owner address? (presuming you're using truffle)...

let Token = artifacts.require("./YourToken.sol");
let ICO = artifacts.require("./YourIco.sol");

module.exports = function (deployer)  {
    // Deploy the ICO First, and then we can use that address later:
    deployer.deploy(ICO).then(function() {
        return deployer.deploy(Token,ICO.address);

Then as mentioned above run something like this as your constructor:

constructor (address _tokenOwner) public {
   _tokenOwner = totalSupply;

That might do it - I'm doing something similar the other way around.

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.