{
    "Function": "deployLiquidityPool",
    "File": "src/PoolManager.sol",
    "Parent Contracts": [
        "src/util/Auth.sol"
    ],
    "High-Level Calls": [
        "EscrowLike",
        "EscrowLike",
        "AuthLike",
        "AuthLike",
        "ERC2771Like",
        "LiquidityPoolFactoryLike"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "require(bool,string)",
        "isAllowedAsPoolCurrency",
        "require(bool,string)",
        "require(bool,string)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function deployLiquidityPool(uint64 poolId, bytes16 trancheId, address currency) public returns (address) {\n        Tranche storage tranche = pools[poolId].tranches[trancheId];\n        require(tranche.token != address(0), \"PoolManager/tranche-does-not-exist\"); // Tranche must have been added\n        require(isAllowedAsPoolCurrency(poolId, currency), \"PoolManager/currency-not-supported\"); // Currency must be supported by pool\n\n        address liquidityPool = tranche.liquidityPools[currency];\n        require(liquidityPool == address(0), \"PoolManager/liquidityPool-already-deployed\");\n        require(pools[poolId].createdAt != 0, \"PoolManager/pool-does-not-exist\");\n\n        address[] memory liquidityPoolWards = new address[](1);\n        liquidityPoolWards[0] = address(investmentManager);\n        liquidityPool = liquidityPoolFactory.newLiquidityPool(\n            poolId, trancheId, currency, tranche.token, address(investmentManager), liquidityPoolWards\n        );\n\n        tranche.liquidityPools[currency] = liquidityPool;\n        AuthLike(address(investmentManager)).rely(liquidityPool);\n\n        // Enable LP to take the tranche tokens out of escrow in case if investments\n        AuthLike(tranche.token).rely(liquidityPool); // Add liquidityPool as ward on tranche token\n        ERC2771Like(tranche.token).addLiquidityPool(liquidityPool);\n        EscrowLike(escrow).approve(liquidityPool, address(investmentManager), type(uint256).max); // Approve investment manager on tranche token for coordinating transfers\n        EscrowLike(escrow).approve(liquidityPool, liquidityPool, type(uint256).max); // Approve liquidityPool on tranche token to be able to burn\n\n        emit LiquidityPoolDeployed(poolId, trancheId, liquidityPool);\n        return liquidityPool;\n    }"
}