{
    "Function": "urgentRedemption",
    "File": "contracts/src/TroveManager.sol",
    "Parent Contracts": [
        "contracts/src/Interfaces/ITroveEvents.sol",
        "contracts/src/Interfaces/ITroveManager.sol",
        "contracts/src/Dependencies/LiquityBase.sol",
        "contracts/src/Interfaces/ILiquityBase.sol"
    ],
    "High-Level Calls": [
        "IPriceFeed",
        "IActivePool",
        "IActivePool",
        "IBoldToken"
    ],
    "Internal Calls": [
        "_requireBoldBalanceCoversRedemption",
        "revert MinCollNotReached(uint256)",
        "_requireIsShutDown",
        "_requireWhitelisted",
        "_updateBatchInterestPriorToRedemption",
        "_isActiveOrZombie",
        "_requireAmountGreaterThanZero",
        "_getBatchManager",
        "_urgentRedeemCollateralFromTrove",
        "_getLatestTroveData"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function urgentRedemption(uint256 _boldAmount, uint256[] calldata _troveIds, uint256 _minCollateral) external {\n        _requireIsShutDown();\n        _requireAmountGreaterThanZero(_boldAmount);\n        _requireBoldBalanceCoversRedemption(boldToken, msg.sender, _boldAmount);\n\n        IWhitelist whitelist = whitelist;\n        if (address(whitelist) != address(0)) {\n            _requireWhitelisted(whitelist, msg.sender);\n        }\n\n        IActivePool activePoolCached = activePool;\n        TroveChange memory totalsTroveChange;\n\n        // Use the standard fetchPrice here, since if branch has shut down we don't worry about small redemption arbs\n        (uint256 price, ) = priceFeed.fetchPrice();\n\n        uint256 remainingBold = _boldAmount;\n        for (uint256 i = 0; i < _troveIds.length; i++) {\n            if (remainingBold == 0) break;\n\n            SingleRedemptionValues memory singleRedemption;\n            singleRedemption.troveId = _troveIds[i];\n            _getLatestTroveData(singleRedemption.troveId, singleRedemption.trove);\n\n            if (!_isActiveOrZombie(Troves[singleRedemption.troveId].status) || singleRedemption.trove.entireDebt == 0) {\n                continue;\n            }\n\n            // If it\u2019s in a batch, we need to update interest first\n            // As we don\u2019t have them ordered now, we cannot avoid repeating for each trove in the same batch\n            singleRedemption.batchAddress = _getBatchManager(singleRedemption.troveId);\n            if (singleRedemption.batchAddress != address(0)) {\n                _updateBatchInterestPriorToRedemption(activePoolCached, singleRedemption.batchAddress);\n            }\n\n            _urgentRedeemCollateralFromTrove(defaultPool, remainingBold, price, singleRedemption);\n\n            totalsTroveChange.collDecrease += singleRedemption.collLot;\n            totalsTroveChange.debtDecrease += singleRedemption.boldLot;\n            totalsTroveChange.appliedRedistBoldDebtGain += singleRedemption.appliedRedistBoldDebtGain;\n            // For recorded and weighted recorded debt totals, we need to capture the increases and decreases,\n            // since the net debt change for a given Trove could be positive or negative: redemptions decrease a Trove's recorded\n            // (and weighted recorded) debt, but the accrued interest increases it.\n            totalsTroveChange.newWeightedRecordedDebt += singleRedemption.newWeightedRecordedDebt;\n            totalsTroveChange.oldWeightedRecordedDebt += singleRedemption.oldWeightedRecordedDebt;\n\n            remainingBold -= singleRedemption.boldLot;\n        }\n\n        if (totalsTroveChange.collDecrease < _minCollateral) {\n            revert MinCollNotReached(totalsTroveChange.collDecrease);\n        }\n\n        emit Redemption(_boldAmount, totalsTroveChange.debtDecrease, totalsTroveChange.collDecrease, 0, price);\n\n        // Since this branch is shut down, this will mint 0 interest.\n        // We call this only to update the aggregate debt and weighted debt trackers.\n        activePoolCached.mintAggInterestAndAccountForTroveChange(totalsTroveChange, address(0));\n\n        // Send the redeemed coll to caller\n        activePoolCached.sendColl(msg.sender, totalsTroveChange.collDecrease);\n        // Burn bold\n        boldToken.burn(msg.sender, totalsTroveChange.debtDecrease);\n    }"
}