Issue:
creditFacade is currently only set once in AbstractAdapter in constructor, based on the current Credit Facade attached to the corresponding Credit Manager:
constructor(address _creditManager, address _targetContract) {
if (_creditManager == address(0) || _targetContract == address(0))
revert ZeroAddressException(); // F:[AA-2]
creditManager = ICreditManagerV2(_creditManager); // F:[AA-1]
creditFacade = ICreditManagerV2(_creditManager).creditFacade(); // F:[AA-1]
targetContract = _targetContract; // F:[AA-1]
}
This causes issues when the Credit Facade is updated in the CM, since the adapter no longer recognizes calls from the CF, and performs all health checks, even during a multicall.
Proposed solution:
AbstractAdapter must be updated to retrieve the CreditFacade dynamically from CreditManager each time it is needed, so the current Credit Facade is always recognized. E.g., _fastCheck() would be modified as follows:
function _fastCheck(
address creditAccount,
address tokenIn,
address tokenOut,
uint256 balanceInBefore,
uint256 balanceOutBefore,
bool disableTokenIn
) private {
address creditFacade = creditManager.creditFacade();
if (msg.sender != creditFacade) {
creditManager.fastCollateralCheck(
creditAccount,
tokenIn,
tokenOut,
balanceInBefore,
balanceOutBefore
);
} else {
if (disableTokenIn)
creditManager.disableToken(creditAccount, tokenIn);
creditManager.checkAndEnableToken(creditAccount, tokenOut);
}
}
Issue:
creditFacadeis currently only set once inAbstractAdapterin constructor, based on the current Credit Facade attached to the corresponding Credit Manager:This causes issues when the Credit Facade is updated in the CM, since the adapter no longer recognizes calls from the CF, and performs all health checks, even during a multicall.
Proposed solution:
AbstractAdaptermust be updated to retrieve the CreditFacade dynamically from CreditManager each time it is needed, so the current Credit Facade is always recognized. E.g.,_fastCheck()would be modified as follows: