{
    "Function": "_completeQueuedWithdrawal",
    "File": "src/contracts/core/StrategyManager.sol",
    "Parent Contracts": [
        "src/contracts/core/StrategyManagerStorage.sol",
        "src/contracts/interfaces/IStrategyManager.sol",
        "src/contracts/permissions/Pausable.sol",
        "src/contracts/interfaces/IPausable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [
        "IStrategy",
        "ISlasher"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "_addShares",
        "require(bool,string)",
        "require(bool,string)",
        "_withdrawBeaconChainETH",
        "calculateWithdrawalRoot",
        "onlyNotFrozen",
        "require(bool,string)",
        "require(bool,string)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _completeQueuedWithdrawal(QueuedWithdrawal calldata queuedWithdrawal, IERC20[] calldata tokens, uint256 middlewareTimesIndex, bool receiveAsTokens) onlyNotFrozen(queuedWithdrawal.delegatedAddress) internal {\n        // find the withdrawalRoot\n        bytes32 withdrawalRoot = calculateWithdrawalRoot(queuedWithdrawal);\n\n        // verify that the queued withdrawal is pending\n        require(\n            withdrawalRootPending[withdrawalRoot],\n            \"StrategyManager.completeQueuedWithdrawal: withdrawal is not pending\"\n        );\n\n        require(\n            slasher.canWithdraw(queuedWithdrawal.delegatedAddress, queuedWithdrawal.withdrawalStartBlock, middlewareTimesIndex),\n            \"StrategyManager.completeQueuedWithdrawal: shares pending withdrawal are still slashable\"\n        );\n\n        // enforce minimum delay lag (not applied to withdrawals of 'beaconChainETH', since the EigenPods enforce their own delay)\n        require(queuedWithdrawal.withdrawalStartBlock + withdrawalDelayBlocks <= block.number \n                || queuedWithdrawal.strategies[0] == beaconChainETHStrategy,\n            \"StrategyManager.completeQueuedWithdrawal: withdrawalDelayBlocks period has not yet passed\"\n        );\n\n        require(\n            msg.sender == queuedWithdrawal.withdrawerAndNonce.withdrawer,\n            \"StrategyManager.completeQueuedWithdrawal: only specified withdrawer can complete a queued withdrawal\"\n        );\n\n        // reset the storage slot in mapping of queued withdrawals\n        withdrawalRootPending[withdrawalRoot] = false;\n\n        // store length for gas savings\n        uint256 strategiesLength = queuedWithdrawal.strategies.length;\n        // if the withdrawer has flagged to receive the funds as tokens, withdraw from strategies\n        if (receiveAsTokens) {\n            require(tokens.length == queuedWithdrawal.strategies.length, \"StrategyManager.completeQueuedWithdrawal: input length mismatch\");\n            // actually withdraw the funds\n            for (uint256 i = 0; i < strategiesLength;) {\n                if (queuedWithdrawal.strategies[i] == beaconChainETHStrategy) {\n\n                    // if the strategy is the beaconchaineth strat, then withdraw through the EigenPod flow\n                    _withdrawBeaconChainETH(queuedWithdrawal.depositor, msg.sender, queuedWithdrawal.shares[i]);\n                } else {\n                    // tell the strategy to send the appropriate amount of funds to the depositor\n                    queuedWithdrawal.strategies[i].withdraw(\n                        msg.sender, tokens[i], queuedWithdrawal.shares[i]\n                    );\n                }\n                unchecked {\n                    ++i;\n                }\n            }\n        } else {\n            // else increase their shares\n            for (uint256 i = 0; i < strategiesLength;) {\n                _addShares(msg.sender, queuedWithdrawal.strategies[i], queuedWithdrawal.shares[i]);\n                unchecked {\n                    ++i;\n                }\n            }\n        }\n        emit WithdrawalCompleted(queuedWithdrawal.depositor, queuedWithdrawal.withdrawerAndNonce.nonce, msg.sender, withdrawalRoot);\n    }"
}