pragma solidity ^0.4.0;

contract Test{

    address _owner;
uint160 _c; constructor() public{
_owner = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
_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;
accounts.transfer(msg.value); //msg.value 全局变量,在value中直接赋值
return accounts.send(msg.value);
/*
send():
递归深度不能超过1024
如果gas不够,执行会失败,只会返回false,不能报异常
检查是否转账成功
transfer 相对 send 较安全
*/
} function getbalance() constant public returns(uint){ return accounts.balance;
} function getownerbalance() constant public returns(uint){ return owner.balance;
}
}

ethereum(以太坊)(八)--Address的更多相关文章

  1. ethereum(以太坊)(一)

    从这周开始,开始学习以太坊开发--solidity,开始决定往区块链方向发展,毕竟区块链技术应用广泛.一开始接触solidity开发语言不太习惯,毕竟一直在学习python语法,有很多都不能接受.有难 ...

  2. ethereum(以太坊)(实例)--"安全的远程购买"

    pragma solidity ^0.4.10; contract Safebuy{ uint public price; address public seller; address public ...

  3. ethereum(以太坊)(实例)--"简单的公开竞拍"

    说真的,刚开始接触这个竞拍案例--“简单的公开竞拍”,我就抱着简单的心态去查看这个实例,但是自我感觉并不简单.应该是我实力不到家的原因吧!!!233333...不过经过大半天的努力,自己理解完之后,觉 ...

  4. ethereum(以太坊)(基础)--容易忽略的坑(二)

    pragma solidity ^0.4.0; contract EMath{ string public _a="lin"; function f() public{ modif ...

  5. ethereum(以太坊)(基础)--容易忽略的坑(一)

    pragma solidity ^0.4.0; contract base{ address public _owner=msg.sender; uint _a; string internal _b ...

  6. ethereum(以太坊)(十三)--异常处理/元祖

    pragma solidity ^0.4.4; contract Students{ uint[] data= new uint[](4); address _owner = msg.sender; ...

  7. ethereum(以太坊)(十二)--应用(二)__投票(基础总和)

    编写应用合约之前,先弄清它的逻辑,有助于我们更好的部署合约 pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; contract vo ...

  8. ethereum(以太坊)(十二)--应用(一)__集资(构造函数/映射)

    pragma solidity ^0.4.4; contract funder{ //0xca35b7d915458ef540ade6068dfe2f44e8fa733c //0x14723a09ac ...

  9. ethereum(以太坊)(十)--函数修饰符

    pragma solidity ^0.4.0; contract modifierTest{ uint public v1; uint constant v2 =10; //uint constant ...

随机推荐

  1. 小程序 页面到详情的id传递

    比如电影列表页跳转到电影详情页 在movie.js获取movieId; processDoubanData: function (moviesDouban, settedKey, categoryTi ...

  2. 启动和停止GlassFish Server

    您可以使用NetBeans IDE或命令行启动和停止GlassFish Server.   使用NetBeans IDE启动GlassFish Server 单击“服务”选项卡. 展开服务器. 右键单 ...

  3. [LeetCode]17. Letter Combinations of a Phone Number电话号码的字母组合

    Given a string containing digits from 2-9 inclusive, return all possible letter combinations that th ...

  4. Android大牛

    张鸿洋 http://blog.csdn.net/lmj623565791/article/category/2680597 CSDN 鸿洋:http://blog.csdn.net/lmj62356 ...

  5. 将pugixml库编译成动态库的做法

    作者:朱金灿 来源:http://blog.csdn.net/clever101 pugixml库默认是编译成静态库的.要把pugixml库编译成一个动态库,需要对代码做一些修改,具体是将 // If ...

  6. Web前端开发规范(二)

    3.HTML代码规范 .html文件必须存放在项目工程约定的目录中. .html文件的命名:以模块 + 功能的结合方式来命名,比如:newsList.html. 文档类型声明:HTML4中使用< ...

  7. python3 爬虫笔记(一)beautiful_soup

    很多人学习python,爬虫入门,在python爬虫中,有很多库供开发使用. 用于请求的urllib(python3)和request基本库,xpath,beautiful soup,pyquery这 ...

  8. PHP:如果正确加载js、css、images等静态文件

    日常中,我们想要把一些静态页面放在框架上或者是进行转移时,那么静态页面上的原url加载js.css.images都会失效,那么我们应该怎么进行修改捏? 现在仓鼠做个笔记哈 这里有几个注意项: 1.路径 ...

  9. 【js基础修炼之路】— 深入浅出理解闭包

    之前对于闭包的理解只是很肤浅的,只是浮于表面,这次深究了一下闭包,下面是我对闭包的理解. 什么是闭包? 引用高程里的话 => 闭包就是有权访问另一个作用域中变量的函数,闭包是由函数以及创建该函数 ...

  10. leetcode: 哈希——two-sum,3sum,4sum

    1). two-sum Given an array of integers, find two numbers such that they add up to a specific target ...