请问为什么我部署了以太币之后显示是这个

pragma solidity ^0.4.0;

contract TestAddr {

    constructor() public payable {

    }

    // 获取一个账号的余额,注意把地址替换为自己的账号地址
    function testBlance() public constant returns (uint) {
        address a = 0x5fC754A1640873b6E75d3e8763788Efb5E54f136;
        return a.balance;  // wei   1eth = 10e18wei
    }

    // 参看合约地址余额,在创建账号的时候附加一个以太币
    function testSelfBlance() public constant returns (uint) {
        address a = this;
        return a.balance;
    }
}

下面是deploy的结果 QQ20200420204508.jpg

请先 登录 后评论

1 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
  • 1 关注
  • 0 收藏,2327 浏览
  • 徐文宣 提出于 2020-04-20 20:45