_isExternalLendingUnhealthy() using stale factors
In `checkRebalance()` -> _isExternalLendingUnhealthy() -> getTargetExternalLendingAmount(factors) using stale `factors` will lead to inaccurate `targetAmount`, which in turn will cause `checkRebalance()` that should have been rebalance to not execute.\\nrebalancingBot uses `checkRebalance()` to return the `currencyIds []` that need to be `rebalance`.\\ncall order : `checkRebalance()` -> `_isExternalLendingUnhealthy()` -> `ExternalLending.getTargetExternalLendingAmount(factors)`\\n```\\n    function _isExternalLendingUnhealthy(\\n        uint16 currencyId,\\n        IPrimeCashHoldingsOracle oracle,\\n        PrimeRate memory pr\\n    ) internal view returns (bool isExternalLendingUnhealthy, OracleData memory oracleData, uint256 targetAmount) {\\n// rest of code\\n\\n      PrimeCashFactors memory factors = PrimeCashExchangeRate.getPrimeCashFactors(currencyId);\\n        Token memory underlyingToken = TokenHandler.getUnderlyingToken(currencyId);\\n\\n        targetAmount = ExternalLending.getTargetExternalLendingAmount(\\n            underlyingToken, factors, rebalancingTargetData, oracleData, pr\\n        );\\n```\\n\\nA very important logic is to get `targetAmount`. The calculation of this value depends on `factors`. But currently used is PrimeCashFactors memory `factors` = PrimeCashExchangeRate.getPrimeCashFactors(currencyId);. This is not the latest. It has not been aggregated yet. The correct one should be `( /* */,factors) = PrimeCashExchangeRate.getPrimeCashRateView();`.
```\\n    function _isExternalLendingUnhealthy(\\n        uint16 currencyId,\\n        IPrimeCashHoldingsOracle oracle,\\n        PrimeRate memory pr\\n    ) internal view returns (bool isExternalLendingUnhealthy, OracleData memory oracleData, uint256 targetAmount) {\\n// rest of code\\n\\n// Remove the line below\\n       PrimeCashFactors memory factors = PrimeCashExchangeRate.getPrimeCashFactors(currencyId);\\n// Add the line below\\n       ( /* */,PrimeCashFactors memory factors) = PrimeCashExchangeRate.getPrimeCashRateView();\\n        Token memory underlyingToken = TokenHandler.getUnderlyingToken(currencyId);\\n\\n        targetAmount = ExternalLending.getTargetExternalLendingAmount(\\n            underlyingToken, factors, rebalancingTargetData, oracleData, pr\\n        );\\n```\\n
Due to the incorrect `targetAmount`, it may cause the `currencyId` that should have been re-executed `Rebalance` to not execute `rebalance`, increasing the risk of the protocol.
```\\n    function _isExternalLendingUnhealthy(\\n        uint16 currencyId,\\n        IPrimeCashHoldingsOracle oracle,\\n        PrimeRate memory pr\\n    ) internal view returns (bool isExternalLendingUnhealthy, OracleData memory oracleData, uint256 targetAmount) {\\n// rest of code\\n\\n      PrimeCashFactors memory factors = PrimeCashExchangeRate.getPrimeCashFactors(currencyId);\\n        Token memory underlyingToken = TokenHandler.getUnderlyingToken(currencyId);\\n\\n        targetAmount = ExternalLending.getTargetExternalLendingAmount(\\n            underlyingToken, factors, rebalancingTargetData, oracleData, pr\\n        );\\n```\\n