Total Supply not displayed

Here my code, but Total Supply is not displayed. I’m so stupid? (here the contract (https://testnet.bscscan.com/address/0xd102f3fcdb3edc93d238fb5e4d7371f2d1156f1d)

pragma solidity ^0.6.12;
//SPDX-License-Identifier: Unlicensed

contract TotalsupplyDisplay {

string public name;
string public symbol;
uint public decimals;
uint public _totalSupply;

mapping (address => uint) public balances;

constructor() public {
    
   _totalSupply = 100000000000 * (10 ** uint(decimals));
   name = "TokenName";
   symbol = "TKN";
   decimals = 7;
   
}

function totalSupply() public view returns (uint256) {
    return (_totalSupply);
}

function balanceOf(address tokenOwner) public view returns (uint) {
    return balances[tokenOwner];
}


}

Why is Total Supply not displayed?

Thank you in advanced.

1 Like

Hi, welcome! :wave:

I just deploy your contract, and it looks like all is good.

image

1 Like

Hi @phoenix1977,

You have set a total supply. I verified the contract and you can read the value of BSCscan.

Please note, you don’t have a valid ERC20 token, so it won’t display as an ERC20 token.

If you want to create an ERC20 token, please see the OpenZeppelin Contracts Wizard
https://zpl.in/wizard

Hello that is true for the BSC link above and the other screenshot provided by the remix input field, However how can we see the total supply displayed on the overview section of BSC? Please see example below:

Screen Shot 2021-04-27 at 9.34.35 PM

Hi @d3vonks26,

I am not familiar with BSC so you may want to ask in the Binance community how this is done.

1 Like

@abcoathup thank you, sounds good - I’m just now entering the blockchain dev community - do you know what is a good online source to tap into the BSC community?

Hi, welcome! :wave:

Which token are you trying to show? Could you please show the contract address?

Try https://community.binance.org/

1 Like

hello - yes, I get an error when trying to Verify and Publish the contract to BSC Scan.

this is the contract: 0x01001667ff99a19b503f28c5de1c2122f304db89

BSC contract link:

this is the error I get on BSC when trying to verify and publish the contract:
not found: File import callback not supported

This is the code I deployed using open zepellin and remix:

@abcoathup any thoughts on this would be greatly appreciated as well. I think I’d have this same import issue on Etherscan as well

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

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Presidente is ERC20, Ownable {
    constructor() ERC20("Presidente", "PRES") {
        _mint(msg.sender, 1000000 * 10 ** decimals());
    }

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
}
   

this is the full error on BSC

Sorry, I am not familiar with the BSC-Chain, maybe you should ask for help in their forum: Home | Binance Chain Forum

And they have a documentation about how to verify contracts, maybe you can have a look at it:

Someone has helped you verify the contract. And now it has showed the totalSupply()

1 Like

@Skyge In order to verify it, I ended up having to copy/paste all the code from the Open Zeppelin files I was getting via those imports in my code.

But isn’t that counter intuitive and cumbersome?

There must be a better way/practice to do this, as importing third party libs is a acceptable practice and part of any software development.

Have you looked the doc I mentioned above? It uses a plugin to verify contracts, so I think there is no need to copy/paste from the OpenZeppelin files.

1 Like

Yeah that Binance Doc for Hardhat contract verification is incomplete it says to add the API Key in the config.js but shows no example of where the API key should go… :frowning:

IIRC, in your hardhat.config.js , add config like this:

module.exports = {
  xxx,
  etherscan: {
    apiKey: YOUR_ETHERSCAN_KEY,
  },
}

And then try to verify.
For more details, you can look at here: Verify the source code with Hardhat

1 Like