1

Why the "totalSupply" of the token is not showing up on Etherscan in the Read Contract section? It supposed to be 1 billion fixed supply and the smart contract (0xE22059E42AE5683b21E3C66E57e14Fee593E22c9) is super simple.

Is it possible to create an additional smart contract and add it to the Etherscan to reflect the total token supply? If not, how users can check the total supply of the token if it's not showing up on the Etherscan?

Here is the token smart contract:

enter image description here enter image description here

1 Answer 1

1

The problem comes from the fact that, in EIP20Interface, the totalSupply's visibility is not specified.

When visibility is not specified, state variables have the default value of internal.

So totalSupply is internal and you have not created a getter for it so you can't access it from a smart contract. You can access the storage slot of totalSupply with ethers.js or forge/foundry I guess, but not very practical..

You should redeploy your contract with

abstract contract EIP20Interface {

     uint256 public totalSupply

Hope this helps

2
  • Thank you! That was very helpful.
    – Adam
    Nov 3, 2022 at 14:26
  • You are welcome! If you could mark my answer as valid so other people find it more easily if they have the same problem, that would be great! Nov 3, 2022 at 14:35

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.