Skip to content

Instantly share code, notes, and snippets.

@sogoiii
Created February 19, 2018 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sogoiii/4aa6b2fd90a79400f5f92af11afddd92 to your computer and use it in GitHub Desktop.
Save sogoiii/4aa6b2fd90a79400f5f92af11afddd92 to your computer and use it in GitHub Desktop.
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