Created
December 20, 2017 08:26
-
-
Save blueplanet/e8612c46974fc2041c605b66a6f46e50 to your computer and use it in GitHub Desktop.
アップデートできるスマートコントラクトを実装してみました ref: https://qiita.com/blueplanet/items/b639a90b44288eb29c9e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.17; | |
contract InnerContract { | |
function say() public pure returns (bytes32) { | |
return "first ver"; | |
} | |
} | |
contract MyContract { | |
address public owner; | |
address public innerContractAddress; | |
modifier onlyOwner() { | |
require(msg.sender == owner); | |
_; | |
} | |
function MyContract() public { | |
owner = msg.sender; | |
} | |
function say() public view returns (bytes32) { | |
InnerContract innerContract = InnerContract(innerContractAddress); | |
return innerContract.say(); | |
} | |
function setInnerContract(address new_address) public onlyOwner { | |
innerContractAddress = new_address; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract InnerContract { | |
function say() public pure returns (bytes32) { | |
return "second ver"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment