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
Skyge
April 21, 2021, 1:43am
2
Hi, welcome!
I just deploy your contract, and it looks like all is good.
1 Like
Hi @phoenix1977 ,
You have set a total supply. I verified the contract and you can read the value of BSCscan.
The Contract Address 0xd102f3fcdb3edc93d238fb5e4d7371f2d1156f1d page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...
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:
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?
Skyge
April 29, 2021, 1:38am
7
Hi, welcome!
Which token are you trying to show? Could you please show the contract address?
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:
Presidente (PRES) Token Tracker on BscScan shows the price of the Token $0.0000, total supply 1,000,000, number of holders 1 and updated information of the token. The token tracker page also shows the analytics and historical data.
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
Skyge
April 29, 2021, 2:56pm
10
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.
Skyge
April 30, 2021, 11:26pm
12
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…
Skyge
May 1, 2021, 1:03am
14
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