I still cannot figure out how to fix this issue. Already deployed the contract a few times with different changes but the problem has not been resolved :(

Basically, this is a fixed supply token contract with 1,000,000 tokens and 18 decimals. When the contract deployed to mainnet via Remix (_initialAmount indicated correctly with all 18 decimals/zeroes, i.e. 1000000000000000000000000), Etherscan shows "totalSupply" also with extra 18 zeroes in Contract/Read Contract section (which is wrong!). Max Total Supply in Etherscan shows the correct amount (1,000,000 tokens) and also the correct amount (1,000,000) is transferred to the contract deployer, so the issue is only with the "totalSupply" amount in Etherscan Read Contract section. Please help - probably need to change contract parameters but they look fine to me ... The contract itself is very simple, please see below.

pragma solidity ^0.8.17;
    ///SPDX-License-Identifier: MIT
    interface XXXXXX {
    function balanceOf(address _owner) external view returns (uint256 balance);
    function transfer(address _to, uint256 _value) external returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
    function approve(address _spender, uint256 _value) external returns (bool success);
    function allowance(address _owner, address _spender) external view returns (uint256 remaining);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

pragma solidity ^0.8.17;
    ///SPDX-License-Identifier: MIT

import "XXXXXX.sol";
contract ZZZZZZ is XXXXXX {

    uint256 public totalSupply;
    uint256 constant private MAX_UINT256 = 2**256 - 1;
    mapping (address => uint256) public balances;
    mapping (address => mapping (address => uint256)) public allowed;

    string public name;                   
    uint8 public decimals;                
    string public symbol;                 

    constructor (
        uint256 _initialAmount,
        string memory _tokenName,
        uint8 _decimalUnits,
        string memory _tokenSymbol
    ) public {
        balances[msg.sender] = _initialAmount;               
        totalSupply = _initialAmount;                        
        name = _tokenName;                                   
        decimals = _decimalUnits;                            
        symbol = _tokenSymbol;                               

    function transfer(address _to, uint256 _value) override public returns (bool success) {
        require(balances[msg.sender] >= _value);
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars
        return true;

    function transferFrom(address _from, address _to, uint256 _value) override public returns (bool success) {
        uint256 allowance = allowed[_from][msg.sender];
        require(balances[_from] >= _value && allowance >= _value);
        balances[_to] += _value;
        balances[_from] -= _value;
        if (allowance < MAX_UINT256) {
            allowed[_from][msg.sender] -= _value;
        emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
        return true;

    function balanceOf(address _owner) override public view returns (uint256 balance) {
        return balances[_owner];

    function approve(address _spender, uint256 _value) override public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars
        return true;

    function allowance(address _owner, address _spender) override public view returns (uint256 remaining) {
        return allowed[_owner][_spender];

  • Do you have the contract address? Can you supply the deployment parameters? The code seems correct so it is likely the parameters used for deployment were incorrect.
    – Ismael
    Nov 26, 2022 at 19:40

2 Answers 2


It is not an error or a bug. The totalsupply is the number of tokens * decimals.

Etherscan just divides them in its frontend for a better view.

See other coins

enter image description here enter image description here

  • That actually makes sense. Feel free to send your wallet address in the response to this message within next three days and I will send a bonus amount for your answer. If you are interested, of course. Nov 24, 2022 at 13:56
  • thanks. you can donate them to any charity or person you want (including yourself). just mark the question as solved :) that will help @newcontractor
    – Majd TL
    Nov 24, 2022 at 14:05

I think it's because you wrote uint256 _initialAmount and totalSupply = _initialAmount;. Thus, the result you see on _initialAmount is the same as on totalSupply.

  • Thanks for your comment. Do you know how to fix that on a contract level? Nov 24, 2022 at 5:06
  • I think in your constructor, you need to modify this line totalSupply = _initialAmount;. You have to adapt the type you want to associate with totalSupply because, if you leave it like that, you will always get the same result back and front for both variables. So adapt the type of your variables. You adapt as explained above or you adapt the type of _initialAmount (but if I understood correctly you are satisfied with its result.
    – Shaz6
    Nov 24, 2022 at 12:34

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.