demo.sol(地址类型与整型转换):
pragma solidity ^0.4.20;
contract AddressTest {
address _add1 = 0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db; // 地址类型
address _add2 = 0x583031d1113ad414f02576bd6afabfb302140225;
uint160 public _num = 0;
address public _add;
function address2uint160() public returns(uint160){
_num = uint160(_add1); // 地址类型->整型类型
return _num;
}
function uint160ToAddress() public returns(address){
_add = address(_num); // 整型类型->地址类型
return _add;
}
function comAddress() constant public returns(bool){
return _add1 == _add2;
}
function isGreater() constant public returns(bool){
return _add1 > _add2;
}
}
demo.sol(balance属性,获取地址余额):
pragma solidity ^0.4.20;
contract