Skip to content

Instantly share code, notes, and snippets.

@DeviateFish
Created February 14, 2019 09:57
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 DeviateFish/eb992842c6d1a09f35ec93cf4fbb474d to your computer and use it in GitHub Desktop.
Save DeviateFish/eb992842c6d1a09f35ec93cf4fbb474d to your computer and use it in GitHub Desktop.
pragma solidity >=0.4.22 <0.6.0;
contract Machine {
uint256 creationTime;
constructor(uint256 _time) public {
creationTime = _time;
}
}
contract Factory {
function build(uint256 creationTime) public {
new Machine(creationTime);
}
}
contract Commitment {
// Address of the deployed factory above
address public factory;
constructor(address _factory) public {
factory = _factory;
}
function commit(uint256 input) public {
factory.delegatecall(bytes4(keccak256("build(uint256)")), input);
selfdestruct(msg.sender);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment