本地再次编译已部署合约
这里我们部署的还是之前说到的这个librarytest
查找已部署合约在ropsten上的地址:
这是本人的最近三个交易,看看合约创建的交易:
很好,看到我的地址了:
0xcc67ff70259fa82d4bd29e9075268816af9df9b8
回到remix使用ataddress功能
点击at address 把合约搞出来:
你看,确实搞出来了,然后我们把11 replace 成22,来:
来确认一下交易:
确实,这个记录上链了:
最后看看etherscan的交易记录
确实,就是11和22
总结: 欢迎大家来用我的合约
附上被调用合约源码:
pragma solidity ^0.4.16; library Search { function indexOf(uint[] storage self, uint value) public view returns (uint) { for (uint i = 0; i < self.length; i++) if (self[i] == value) return i; return uint(-1); } } contract C { using Search for uint[];//enlarge the operation of elementary type uint[] public data; function append(uint value) public { data.push(value); } function replace(uint _old, uint _new) public { //use library //same as Search.indexOf(data, _old) uint index = data.indexOf(_old); if (index == uint(-1)) data.push(_new); else data[index] = _new; } }