contract Deployer is IDeployer {

    /**
     * @notice Deploys `initcode` using `salt` for defining the deterministic address.
     * @param initcode Initialization code.
     * @param salt Arbitrary value to modify resulting address.
     * @return createdContract Created contract address.
     */
    function deploy(bytes memory initcode, bytes32 salt) external override returns (address payable createdContract) {
        return _deploy(initcode, salt);
    }

    /**
     * @notice Deploys `initcodes` using `salts` for defining the deterministic address.
     * @param initcodes Initialization codes.
     * @param salts Arbitrary values to modify resulting addresses.
     * @return createdContracts Created contract addresses.
     */
    function deployMultiple(bytes[] memory initcodes, bytes32[] memory salts) external override returns (address payable[] memory createdContracts) {
        uint256 length = initcodes.length;
        require(length == salts.length, "length mismatch");
        createdContracts = new address payable[](length);
        for(uint256 i = 0; i < length; i++) {
            createdContracts[i] = _deploy(initcodes[i], salts[i]);
        }
        return createdContracts;
    }

    /**
     * @notice Deploys `initcode` using `salt` for defining the deterministic address.
     * @param initcode Initialization code.
     * @param salt Arbitrary value to modify resulting address.
     * @return createdContract Created contract address.
     */
    function _deploy(bytes memory initcode, bytes32 salt) internal returns (address payable createdContract) {
        assembly {
            createdContract := create2(0, add(initcode, 0x20), mload(initcode), salt)
        }
        require(createdContract != address(0x0), "invalid initcode");
        emit ContractDeployed(createdContract);
        return createdContract;
    }
}
/**
 * @title Deployer
 * @notice Exposes `CREATE2` (EIP-1014) to deploy bytecode on deterministic addresses based on initialization code and salt.
 * @author solace.fi
 */
function deploy(bytes memory initcode, bytes32 salt) external override returns (address payable createdContract) {
        return _deploy(initcode, salt);
    }
/**
 * @notice Deploys `initcode` using `salt` for defining the deterministic address.
 * @param initcode Initialization code.
 * @param salt Arbitrary value to modify resulting address.
 * @return createdContract Created contract address.
 */