ethereum(以太坊)(⼋)--Address pragma solidity ^0.4.0;
contract Test{
address _owner;
uint160 _c;
constructor() public{
_owner = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;solidity
_c = 1154414090619811796818182302139415280051214250812;
}
/*
address _owner;
uint160 _c;
function inter(){
_owner = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
//ca35b7d915458ef540ade6068dfe2f44e8fa733c
//40 * 4 = 160
_c = 1154414090619811796818182302139415280051214250812;
}
0x 45  :16进制
0b 0  1  0  0  0 1 0 1  :2进制
128+64+32+16 +8+4+2+1  69 :10进制
*/
function getUint160() constant returns(uint160){
return uint160(_owner);
}
function getAddress() constant returns(address){
return address(_c);
}
}
/*
to  0xbde95422681e4c3984635af2f2f35f8c44a4ddc9
contract address 0x0fdf4894a3b7c5a101686829063be52ad45bcfb7
from            0xca35b7d915458ef540ade6068dfe2f44e8fa733c
*/
pragma solidity ^0.4.0;
contract modifierTest{
address owner;
uint public v3;
constructor() public{
uint8  _a = 12 ;
uint b = 1;
string memory  str='eilinge';
owner =msg.sender;
}
/*
function  setAddress(address add) public{
owner= add;
}
function getAddress() constant returns(address){
return owner;
}
*/
modifier onlyowner(address own) {
require(own == owner);
_;
}
/
/msg.sender 部署合约时的地址
//在Account切换成其他地址,不需要重新部署合约,直接运⾏即可
//modifierTest at 0xcac3f0403895fadae1c5cb2f9cb5fb0fbda62a37(memory) 当前合约对象的地址
function setv3() onlyowner(msg.sender)  returns(uint){
return v3 += 10;
}
function getthisAddress() constant returns(address){
return this; //xCac3f0403895fAdAE1c5Cb2F9cB5fB0FbDa62a37
}
function getBalance(address add) constant returns(uint){
return add.balance; //参看钱包地址余额:getBalance("0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db") 传⼊参数需要添加("")    }
}
pragma solidity ^0.4.0;
contract modifierTest{
address  public accounts=0xdd870fa1b7c4700f2bd7f44238821c26f7392148;    address owner= msg.sender;
function transfertest() payable public returns(bool){ //payable 转账必须加上//accounts = 0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db;
/*
send():
递归深度不能超过1024
如果gas不够,执⾏会失败,只会返回false,不能报异常
检查是否转账成功
transfer 相对 send 较安全
*/
}
function getbalance() constant public returns(uint){
return accounts.balance;
}
function getownerbalance() constant public returns(uint){
return owner.balance;
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。