{
    "Function": "queueWithdrawal",
    "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": [
        "IDelegationManager",
        "IDelegationManager"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "_undelegate",
        "onlyWhenNotPaused",
        "_removeShares",
        "nonReentrant",
        "require(bool,string)",
        "require(bool,string)",
        "onlyNotFrozen",
        "calculateWithdrawalRoot",
        "require(bool,string)",
        "require(bool,string)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function queueWithdrawal(\n        uint256[] calldata strategyIndexes,\n        IStrategy[] calldata strategies,\n        uint256[] calldata shares,\n        address withdrawer,\n        bool undelegateIfPossible\n    )\n        external\n        onlyWhenNotPaused(PAUSED_WITHDRAWALS)\n        onlyNotFrozen(msg.sender)\n        nonReentrant\n        returns (bytes32)\n    {\n        require(strategies.length == shares.length, \"StrategyManager.queueWithdrawal: input length mismatch\");\n        require(withdrawer != address(0), \"StrategyManager.queueWithdrawal: cannot withdraw to zero address\");\n    \n        // modify delegated shares accordingly, if applicable\n        delegation.decreaseDelegatedShares(msg.sender, strategies, shares);\n\n        uint96 nonce = uint96(numWithdrawalsQueued[msg.sender]);\n        \n        // keeps track of the current index in the `strategyIndexes` array\n        uint256 strategyIndexIndex;\n\n        /**\n         * Ensure that if the withdrawal includes beacon chain ETH, the specified 'withdrawer' is not different than the caller.\n         * This is because shares in the enshrined `beaconChainETHStrategy` ultimately represent tokens in **non-fungible** EigenPods,\n         * while other share in all other strategies represent purely fungible positions.\n         */\n        for (uint256 i = 0; i < strategies.length;) {\n            if (strategies[i] == beaconChainETHStrategy) {\n                require(withdrawer == msg.sender,\n                    \"StrategyManager.queueWithdrawal: cannot queue a withdrawal of Beacon Chain ETH to a different address\");\n                require(strategies.length == 1,\n                    \"StrategyManager.queueWithdrawal: cannot queue a withdrawal including Beacon Chain ETH and other tokens\");\n                require(shares[i] % GWEI_TO_WEI == 0,\n                    \"StrategyManager.queueWithdrawal: cannot queue a withdrawal of Beacon Chain ETH for an non-whole amount of gwei\");\n            }   \n\n            // the internal function will return 'true' in the event the strategy was\n            // removed from the depositor's array of strategies -- i.e. stakerStrategyList[depositor]\n            if (_removeShares(msg.sender, strategyIndexes[strategyIndexIndex], strategies[i], shares[i])) {\n                unchecked {\n                    ++strategyIndexIndex;\n                }\n            }\n\n            emit ShareWithdrawalQueued(msg.sender, nonce, strategies[i], shares[i]);\n\n            //increment the loop\n            unchecked {\n                ++i;\n            }\n        }\n\n        // fetch the address that the `msg.sender` is delegated to\n        address delegatedAddress = delegation.delegatedTo(msg.sender);\n\n        QueuedWithdrawal memory queuedWithdrawal;\n\n        {\n            WithdrawerAndNonce memory withdrawerAndNonce = WithdrawerAndNonce({\n                withdrawer: withdrawer,\n                nonce: nonce\n            });\n            // increment the numWithdrawalsQueued of the sender\n            unchecked {\n                numWithdrawalsQueued[msg.sender] = nonce + 1;\n            }\n\n            // copy arguments into struct and pull delegation info\n            queuedWithdrawal = QueuedWithdrawal({\n                strategies: strategies,\n                shares: shares,\n                depositor: msg.sender,\n                withdrawerAndNonce: withdrawerAndNonce,\n                withdrawalStartBlock: uint32(block.number),\n                delegatedAddress: delegatedAddress\n            });\n\n        }\n\n        // calculate the withdrawal root\n        bytes32 withdrawalRoot = calculateWithdrawalRoot(queuedWithdrawal);\n\n        // mark withdrawal as pending\n        withdrawalRootPending[withdrawalRoot] = true;\n\n        // If the `msg.sender` has withdrawn all of their funds from EigenLayer in this transaction, then they can choose to also undelegate\n        /**\n         * Checking that `stakerStrategyList[msg.sender].length == 0` is not strictly necessary here, but prevents reverting very late in logic,\n         * in the case that 'undelegate' is set to true but the `msg.sender` still has active deposits in EigenLayer.\n         */\n        if (undelegateIfPossible && stakerStrategyList[msg.sender].length == 0) {\n            _undelegate(msg.sender);\n        }\n\n        emit WithdrawalQueued(msg.sender, nonce, withdrawer, delegatedAddress, withdrawalRoot);\n\n        return withdrawalRoot;\n    }"
}