{
    "Function": "_setSingleProtocolPremium",
    "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": [],
    "Internal Calls": [
        "_settleProtocolDebt",
        "_secondsOfCoverageLeft",
        "revert InsufficientBalance(bytes32)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _setSingleProtocolPremium(bytes32 _protocol, uint256 _premium)\n    internal\n    returns (uint256 oldPremiumPerSecond, uint256 nonStakerPercentage)\n  {\n    // _settleProtocolDebt() subtracts debt from the protocol's active balance and updates the % due to nonstakers\n    // Also updates the last accounted timestamp for this protocol\n    // nonStakerPercentage is carried over from _settleProtocolDebt() for gas savings\n    // nonStakerPercentage represents the percentage that goes to nonstakers for this protocol\n    nonStakerPercentage = _settleProtocolDebt(_protocol);\n    // Stores the old premium before it gets updated\n    oldPremiumPerSecond = premiums_[_protocol];\n\n    if (oldPremiumPerSecond != _premium) {\n      // Sets the protocol's premium per second to the new value\n      premiums_[_protocol] = _premium;\n      emit ProtocolPremiumChanged(_protocol, oldPremiumPerSecond, _premium);\n    }\n    // We check if the NEW premium causes the _secondsOfCoverageLeft for the protocol to be less than the threshold for arbing\n    // We don't need to check the min balance requirement for arbs because that value doesn't change like secondsOfCoverageLeft changes\n    // Effectively we just need to make sure we don't accidentally run a protocol's active balance down below the point\n    // Where arbs would no longer be incentivized to remove the protocol\n    // Because if a protocol is not removed by arbs before running out of active balance, this can cause problems\n    if (_premium != 0 && _secondsOfCoverageLeft(_protocol) < MIN_SECONDS_OF_COVERAGE) {\n      revert InsufficientBalance(_protocol);\n    }\n  }"
}