请问为什么我本地能显示totalsupply的数量,测试网不能显示?

请问为什么我在测试网部署完,totalsupply 可以显示正确的数量,但是测试网不能显示 totalsupply 的数量啊?

测试网地址 :https://ropsten.etherscan.io/token/0x765a8e2f0d1247e0ee814ea1373e340337fe7a07

QQ20210516102148.png

附上代码:

interface 代码

pragma solidity >=0.4.22 <0.7.0;

contract ERC20Interface { string public name; string public symbol; uint8 public decimals; uint public totalsupply;

function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);

function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender)  view returns (uint256 remaining);

event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _Owner, address indexed _spender, uint256 _value);

}

---==================================================================================================================================================

erc20代币代码

pragma solidity >=0.4.20;

import './erc20interface.sol';

contract ERC20 is ERC20Interface {

mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) allowed;

constructor() public {
  name = "zhangli";
  symbol = "ZL";
  decimals = 0;
  totalsupply = 1000000000;
  balanceOf[msg.sender] = totalsupply;

}

function transfer(address _to, uint256 _value) returns (bool success){
    require(_to != address(0));
    require(balanceOf[msg.sender] >= _value);
    require(balanceOf[ _to] + _value >= balanceOf[ _to]); 

    balanceOf[msg.sender] -= _value;
    balanceOf[_to] += _value;

     emit Transfer(msg.sender, _to, _value);

     return true;
    }

function transferFrom(address _from, address _to, uint256 _value) returns (bool success){
    require(_to != address(0));
    require(allowed[_from][msg.sender] >= _value);
    require(balanceOf[_from] >= _value);
    require(balanceOf[ _to] + _value >= balanceOf[ _to]); 

    balanceOf[_from] -= _value;
    balanceOf[_to] += _value;

    allowed[_from][msg.sender] -= _value;

    emit Transfer(msg.sender, _to, _value);

     return true;
    }

function approve(address _spender, uint256 _value) returns (bool success){
        allowed[msg.sender][_spender] = _value;

        emit Approval(msg.sender,_spender,_value);
        return true;
    }

function allowance(address _owner, address _spender)  view returns (uint256 remaining){
        return allowed[_owner][_spender];
    }

}

请先 登录 后评论

2 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
Alan
请先 登录 后评论
  • 2 关注
  • 0 收藏,2172 浏览
  • yonghulaile 提出于 2021-05-16 10:36