{
    "Function": "calculateAddressUnsafe",
    "File": "src/views/AddressCalculation.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "InstanceDeployer",
        "TimelockFactory",
        "InstanceDeployer",
        "SafeProxyFactory",
        "InstanceDeployer"
    ],
    "Internal Calls": [
        "calculateCreate2Address",
        "keccak256(bytes)",
        "abi.encodePacked()",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "abi.encodeWithSignature()",
        "abi.encodePacked()",
        "abi.encode()",
        "calculateCreate2Address",
        "abi.encodePacked()",
        "abi.encode()",
        "keccak256(bytes)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function calculateAddressUnsafe(NewInstance memory instance)\n        public\n        view\n        returns (SystemInstance memory walletInstance)\n    {\n        address[] memory factoryOwner = new address[](1);\n        factoryOwner[0] = instanceDeployer;\n\n        bytes memory safeInitdata = abi.encodeWithSignature(\n            \"setup(address[],uint256,address,bytes,address,address,uint256,address)\",\n            factoryOwner,\n            1,\n            /// no to address because there are no external actions on\n            /// initialization\n            address(0),\n            /// no data because there are no external actions on initialization\n            \"\",\n            /// no fallback handler allowed by Guard\n            address(0),\n            /// no payment token\n            address(0),\n            /// no payment amount\n            0,\n            /// no payment receiver because no payment amount\n            address(0)\n        );\n\n        {\n            uint256 creationSalt = uint256(\n                keccak256(\n                    abi.encode(\n                        instance.owners,\n                        instance.threshold,\n                        instance.timelockParams.minDelay,\n                        instance.timelockParams.expirationPeriod,\n                        instance.timelockParams.pauser,\n                        instance.timelockParams.pauseDuration,\n                        instance.timelockParams.hotSigners\n                    )\n                )\n            );\n\n            /// timelock salt is the result of the all params, so no one can\n            /// front-run creation of the timelock with the same address on other\n            /// chains\n            instance.timelockParams.salt = bytes32(creationSalt);\n\n            bytes32 salt = keccak256(\n                abi.encodePacked(keccak256(safeInitdata), creationSalt)\n            );\n            address safeProxyFactory =\n                InstanceDeployer(instanceDeployer).safeProxyFactory();\n\n            walletInstance.safe = SafeProxy(\n                payable(\n                    calculateCreate2Address(\n                        safeProxyFactory,\n                        SafeProxyFactory(safeProxyFactory).proxyCreationCode(),\n                        abi.encodePacked(\n                            uint256(\n                                uint160(\n                                    InstanceDeployer(instanceDeployer)\n                                        .safeProxyLogic()\n                                )\n                            )\n                        ),\n                        salt\n                    )\n                )\n            );\n        }\n        address timelockFactory =\n            InstanceDeployer(instanceDeployer).timelockFactory();\n\n        Create2Params memory params;\n        params.creator = timelockFactory;\n        params.creationCode =\n            TimelockFactory(timelockFactory).timelockCreationCode();\n\n        params.constructorParams = abi.encode(\n            walletInstance.safe,\n            instance.timelockParams.minDelay,\n            instance.timelockParams.expirationPeriod,\n            instance.timelockParams.pauser,\n            instance.timelockParams.pauseDuration,\n            instance.timelockParams.hotSigners\n        );\n        params.salt = keccak256(\n            abi.encodePacked(instance.timelockParams.salt, instanceDeployer)\n        );\n\n        walletInstance.timelock =\n            Timelock(payable(calculateCreate2Address(params)));\n    }"
}