{
    "Function": "deploySafe",
    "File": "contracts/IdentityFactory.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "mload(uint256)",
        "require(bool,string)",
        "abi.encodePacked()",
        "keccak256(bytes)",
        "require(bool,string)",
        "create2(uint256,uint256,uint256,uint256)",
        "keccak256(bytes)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function deploySafe(bytes memory code, uint256 salt) internal returns (address) {\n\t\taddress expectedAddr = address(uint160(uint256(\n\t\t\tkeccak256(abi.encodePacked(bytes1(0xff), address(this), salt, keccak256(code)))\n\t\t)));\n\t\tuint size;\n\t\tassembly { size := extcodesize(expectedAddr) }\n\t\t// If there is code at that address, we can assume it's the one we were about to deploy,\n\t\t// because of how CREATE2 and keccak256 works\n\t\tif (size == 0) {\n\t\t\taddress addr;\n\t\t\tassembly { addr := create2(0, add(code, 0x20), mload(code), salt) }\n\t\t\trequire(addr != address(0), 'FAILED_DEPLOYING');\n\t\t\trequire(addr == expectedAddr, 'FAILED_MATCH');\n\t\t\temit LogDeployed(addr, salt);\n\t\t}\n\t\treturn expectedAddr;\n\t}"
}