pragma solidity >=0.4.22 <0.6.0; // MachineFactory.sol /// @title A widget contract Machine { // This is our contract that does stuff. We'll be committing to deploying this contract in the future. constructor() public { // etc } } /// @title A widget factory contract MachineFactory { event MachineBuilt(address machine); function build() public { emit MachineBuilt(new Machine()); } } // MachineCommitment.sol /// @title A commitment to make a widget contract MachineCommitment { address factory; constructor(address _factory) public { factory = _factory; } function commit() public { require(factory.delegatecall(bytes4(keccak256("build()")))); selfdestruct(msg.sender); } }
0.4.22