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()); } function getSig() public pure returns(bytes4) { return bytes4(keccak256("build()")); } } // MachineCommitment.sol /// @title A commitment to make a widget contract MachineCommitment { address factory; constructor(address _factory) public { factory = _factory; } function() public { address _factory = factory; assembly { let ptr := mload(0x40) calldatacopy(ptr, 0, calldatasize) pop(delegatecall(gas, _factory, ptr, calldatasize, 0, 0)) } selfdestruct(msg.sender); } }
0.4.22