// Contract: Create3Factory
// Target function: function create3(bytes32 _salt, bytes memory _creationCode) external returns (address addr)
// SPDX-License-Identifier: Unlicense

pragma solidity ^0.8.0;

/**
 * @title A library for deploying contracts EIP-3171 style.
 * @author Agustin Aguilar <aa@horizon.io>
 */
contract Create3Factory {
    /**
     * @notice The bytecode for a contract that proxies the creation of another contract
     * @dev If this code is deployed using CREATE2 it can be used to decouple `creationCode` from the child contract
     * address 0x67363d3d37363d34f03d5260086018f3:
     *
     * 0x00  0x67  0x67XXXXXXXXXXXXXXXX  PUSH8 bytecode  0x363d3d37363d34f0
     * 0x01  0x3d  0x3d                  RETURNDATASIZE  0 0x363d3d37363d34f0
     * 0x02  0x52  0x52                  MSTORE
     * 0x03  0x60  0x6008                PUSH1 08        8
     * 0x04  0x60  0x6018                PUSH1 18        24 8
     * 0x05  0xf3  0xf3                  RETURN
     *
     * 0x363d3d37363d34f0:
     *
     * 0x00  0x36  0x36                  CALLDATASIZE    cds
     * 0x01  0x3d  0x3d                  RETURNDATASIZE  0 cds
     * 0x02  0x3d  0x3d                  RETURNDATASIZE  0 0 cds
     * 0x03  0x37  0x37                  CALLDATACOPY
     * 0x04  0x36  0x36                  CALLDATASIZE    cds
     * 0x05  0x3d  0x3d                  RETURNDATASIZE  0 cds
     * 0x06  0x34  0x34                  CALLVALUE       val 0 cds
     * 0x07  0xf0  0xf0                  CREATE          addr
     */
    bytes public constant PROXY_CHILD_BYTECODE = hex'67_36_3d_3d_37_36_3d_34_f0_3d_52_60_08_60_18_f3';

    // KECCAK_PROXY_BYTECODE = keccak256(PROXY_CHILD_BYTECODE);
    bytes32 public constant KECCAK_PROXY_BYTECODE = 0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f;