{
    "Function": "withdrawLiquidity",
    "File": "contracts/UpsideProtocol.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol"
    ],
    "High-Level Calls": [
        "SafeERC20",
        "SafeERC20"
    ],
    "Internal Calls": [
        "revert CooldownTimerNotEnded()",
        "onlyOwner"
    ],
    "Library Calls": [
        "safeTransfer",
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function withdrawLiquidity(address[] calldata _metaCoinAddresses) external onlyOwner {\n        /// @dev A GLOBAL timer is used - this impacts ALL MetaCoin's past and future\n        // If the timer was not started, start it\n        if (withdrawLiquidityTimerStartTime == 0) {\n            withdrawLiquidityTimerStartTime = block.timestamp;\n\n            // Emit event so it can be tracked\n            emit WithdrawLiquidityTimerStarted(block.timestamp + WITHDRAW_LIQUIDITY_COOLDOWN);\n            return;\n        }\n\n        // Ensure if the countdown was started, the entire cooldown period has passed\n        uint256 withdrawalAllowedBlockTimestamp = withdrawLiquidityTimerStartTime + WITHDRAW_LIQUIDITY_COOLDOWN;\n        if (withdrawalAllowedBlockTimestamp > block.timestamp) revert CooldownTimerNotEnded();\n\n        // Withdrawal logic\n        uint256 tokensToWithdraw;\n\n        for (uint256 i; i < _metaCoinAddresses.length; ) {\n            MetaCoinInfo storage metaCoinInfo = metaCoinInfoMap[_metaCoinAddresses[i]];\n            uint256 liquidityTokensInCurve = metaCoinInfo.liquidityTokenReserves - INITIAL_LIQUIDITY_RESERVES;\n            uint256 metaTokensInCurve = metaCoinInfo.metaCoinReserves;\n\n            // Update the reserve\n            metaCoinInfo.liquidityTokenReserves = INITIAL_LIQUIDITY_RESERVES;\n            metaCoinInfo.metaCoinReserves = 0;\n\n            // Add withdrawal of liquidity tokens to running sum (for transfer later in one go)\n            tokensToWithdraw += liquidityTokensInCurve;\n\n            // Transfer MetaCoin\n            IERC20Metadata(_metaCoinAddresses[i]).safeTransfer(msg.sender, metaTokensInCurve);\n\n            emit LiquidityWithdrawn(_metaCoinAddresses[i], liquidityTokensInCurve, metaTokensInCurve);\n            unchecked {\n                ++i;\n            }\n        }\n\n        // Transfer the total number of liquidity tokens\n        IERC20Metadata(liquidityTokenAddress).safeTransfer(msg.sender, tokensToWithdraw);\n    }"
}