-
-
Save DeviateFish/eb992842c6d1a09f35ec93cf4fbb474d 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.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