Created
February 19, 2018 20:43
-
-
Save sogoiii/4aa6b2fd90a79400f5f92af11afddd92 to your computer and use it in GitHub Desktop.
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.18; | |
contract Worker1 { | |
uint public n; | |
address public sender; | |
function setN(uint _n) public { | |
n = _n; | |
sender = msg.sender; | |
} | |
} | |
contract Worker2 { | |
uint public n; | |
address public sender; | |
function setN(uint _n) public { | |
n = _n * 2; | |
sender = msg.sender; | |
} | |
} | |
contract Factory { | |
address worker; | |
function updateWorker(address _w) public { | |
worker = _w; | |
} | |
function getWorker() view public returns (address) { | |
return worker; | |
} | |
function doWork(uint _val) public { | |
Worker1(worker).setN(_val); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment