I am creating new ERC-20 DOTAToken. I want my token to have total supply 800 millions and 18 decimals. Is it correct way to declare it?

contract DOTAToken {
  string constant public name = "DOTATOKEN";
  string constant public symbol = "DTK";
  uint256 constant public decimals = 18;
  uint256 constant public totalSupply = 8 * 10 ** (8 + 18);

  function DOTAToken () public {
    owner = msg.sender;

1 Answer 1


Basically correct, but you need to set initial balance for owner also and from the beginning, the balance of owner equal to total supply. Total supply is nothing if you dont handle the token balance for each account/address in your smart contract.

for more detail, you can refer to openzeppelin template code



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.