{
    "Function": "withdrawActiveBalance",
    "File": "contracts/managers/SherlockProtocolManager.sol",
    "Parent Contracts": [
        "contracts/managers/Manager.sol",
        "node_modules/@openzeppelin/contracts/security/Pausable.sol",
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/interfaces/managers/ISherlockProtocolManager.sol",
        "contracts/interfaces/managers/IManager.sol"
    ],
    "High-Level Calls": [
        "SafeERC20"
    ],
    "Internal Calls": [
        "revert InsufficientBalance(bytes32)",
        "revert InsufficientBalance(bytes32)",
        "whenNotPaused",
        "revert Unauthorized()",
        "_settleProtocolDebt",
        "revert ZeroArgument()",
        "_secondsOfCoverageLeft",
        "_verifyProtocolExists"
    ],
    "Library Calls": [
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function withdrawActiveBalance(bytes32 _protocol, uint256 _amount)\n    external\n    override\n    whenNotPaused\n  {\n    if (_amount == uint256(0)) revert ZeroArgument();\n    // Only the protocol agent can call this function\n    if (msg.sender != _verifyProtocolExists(_protocol)) revert Unauthorized();\n\n    // Updates the active balance of the protocol\n    _settleProtocolDebt(_protocol);\n\n    // Sets currentBalance to the active balance of the protocol\n    uint256 currentBalance = activeBalances[_protocol];\n    // Reverts if trying to withdraw more than the active balance\n    if (_amount > currentBalance) revert InsufficientBalance(_protocol);\n\n    // Removes the _amount to be withdrawn from the active balance\n    activeBalances[_protocol] = currentBalance - _amount;\n    // Reverts if a protocol has less than 7 days worth of active balance left\n    if (_secondsOfCoverageLeft(_protocol) < MIN_SECONDS_LEFT) revert InsufficientBalance(_protocol);\n\n    // Transfers the amount to the msg.sender (protocol agent)\n    token.safeTransfer(msg.sender, _amount);\n    emit ProtocolBalanceWithdrawn(_protocol, _amount);\n  }"
}