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的结果