0

How do I modify this so that all created tokens go to Owner (the one who receives funds to the Beneficiary address). I assume this contract is one requiring change.

contract ERC20Basic {

  uint256 public totalSupply;
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);

}
1
  • This isn't the actual code of a contract. It's just an interface (function declarations).
    – user19510
    Dec 28 '17 at 12:39
1

What you posted above is just an interface, not the actual token contract. Having said so, you typically want to assign all tokens when deploying the token contract. You should add a constructor function like so:

function ERC20Basic() public {
    totalSupply = 100000 * 10 ** uint(decimals); //Change to whatever initial supply you want
    balances[msg.sender] = totalSupply;
  }

That will assign all the tokens to the account deploying the contract.

2
  • How about this. Same? uint256 constant INITIAL_SUPPLY = xxx* 10**18; function TESTCOIN () public { balances[msg.sender] = INITIAL_SUPPLY;
    – Buzzmuzz5
    Dec 30 '17 at 21:21
  • You are not setting the totalSupply, which is very important. TotalSupply should always match the sum of all balances. Dec 30 '17 at 21:30

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.