2

I have created a contract for erc721 token. The contract inherits open-zeppelin ERC721 smartcontract. When I deploy my contract on remix i can view the supply correctly however the max supply and number of holders is always 0 on ropsten. Can anyone please point out what the issue. My code is as follows:

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/utils/Counters.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/access/Ownable.sol";

contract CryptoGogos is Ownable, ERC721 {
    
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds; //Counter is a struct in the Counters library
    uint constant total_supply =7777; //refers to the combined token amounts
  
    uint public entered_supply;
    string public check_name;
    string internal _tokenURI;
    address _address;
    
    constructor() ERC721("CryptoGogos", "CGG") public {
        _address = msg.sender;
    }
    
    
    //Cards is actually to create a mapping of token id to their tokenURI
    struct Cards{
        string name;
        uint supply; //refers to the total supply of each token 
        string cat;
        uint card_id; //series number in our case
        string description;
        string image_url;
    }
    
    Cards[] private card;
    
    mapping(uint =>Cards) public tokeninfo;
    
    /*tokenURI is the url for metadata in json format.
    bytes32 array is used to receive parsed json data for minting in the following order:
    params[0] = name
    params[1] = supply
    params[2] = category
    params[3] = description
    params[4] = image url
    */
    
    function drawCard(uint _supply) public {
        
        require(_supply<total_supply,
        "Input supply is not less than total supply of cards.");
        _tokenIds.increment();
        uint newNftTokenId = _tokenIds.current();
        
        Cards memory c;
    
        c.card_id = newNftTokenId;
        c.supply = _supply;
        (string memory tu, string memory n, string memory d,string memory ct,string memory i) = getTokenURI(_supply); 
        c.name = n;
        _tokenURI = tu;
        c.description = d;
        c.cat= ct;
        c.image_url = i;
        card.push(c);
        tokeninfo[newNftTokenId] = c;
  
        _safeMint(_address,newNftTokenId) ;
        _setTokenURI(newNftTokenId,_tokenURI);
    }
    
    //passing supply which is user inputted paramter
    function getTokenURI(uint _supply) internal view returns (string memory ,string memory , string memory , string memory , string memory ){
        string memory t1="This is token URI";
        string memory n1 = "token name";
        string memory d1= "token description";
        string memory _c1="token category";
        string memory _i ="image url";
        return (t1,n1,d1,_c1,_i);
    } 
    
    function _safeMint(address to, uint256 tokenId) internal override onlyOwner  {
        _safeMint(to, tokenId, "");
    }
    
    function viewCategory(uint _tokenid) public view returns (string memory) {
        return (tokeninfo[_tokenid].cat);
    }
    
    function viewNumberofCards() public view returns (uint) {
        return _tokenIds.current();
    }
    
    function viewName(uint _tokenid) public view returns (string memory){
        return (tokeninfo[_tokenid].name);
    }
    
    function viewDescription(uint _tokenid) public view returns (string memory){
        return (tokeninfo[_tokenid].description);
    }
    
    function viewImageUrl(uint _tokenid) public view returns (string memory){
        return (tokeninfo[_tokenid].image_url);
    }
    
    function viewtokenURI() public view returns (string memory){
        return (_tokenURI);
    }
    
     function totalSupply() public view override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenIds.current();
    }
}
2

This is not an issue with your code but an issue with Etherscan. In fact, Etherscan does not track anymore on Ropsten the totalSupply and holders of ERC20 and ERC721 tokens for two weeks for an unknown reason.

You can see on this Wrapped Ether ERC20 token the same issue : https://ropsten.etherscan.io/token/0xc778417e063141139fce010982780140aa0cd5ab.

On this DAI ERC20 token too : https://ropsten.etherscan.io/token/0xad6d458402f60fd3bd25163575031acdce07538d

1
  • Yeah you were right the holders and supply were updating on Kovan and binance chain but not on these two. – mzaidi Mar 31 at 6:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.