I created an ERC20 contract with Truffle, everything went right except for one thing: the name and symbol of the token does not show up in etherscan.

I used the ERC20.sol provided by openZeppelin. My contract:

pragma solidity >=0.4.25 <0.6.0;

import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

contract Erc20Token is ERC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;
    mapping (address => mapping (address => uint256)) private _allowed;
    string public tokenName;
    string public tokenSymbol;
    uint256 public decimals;
    uint256 private _totalSupply;

    constructor(string memory _tokenName, string memory _tokenSymbol, uint256 totalSupply, uint256 _decimals) public {
        tokenName = _tokenName;
        tokenSymbol = _tokenSymbol;
        decimals = _decimals;
        _totalSupply = totalSupply;
        _mint(msg.sender, totalSupply);

and the migration contract:

var Erc20Token = artifacts.require("./ERC20Token.sol");

module.exports = function(deployer) {
  deployer.deploy(Erc20Token, "qwerty", "qty", 100000000000000, 8);

Here is an example of a transaction, under "Tokens Transferred" we should find tokenName(tokenSymbol). Any idea of what the problem might be ?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.