Business logic
_calculateMaxBorrowCollateral calculates repay incorrectly and can lead to set token liquidation
The function _calculateMaxBorrowCollateral incorrectly applies unutilizedLeveragePercentage when computing the repay limit, causing an underflow and revert when borrowBalance exceeds a threshold. This prevents the ripcord function from repaying debt, leading to liquidation of the set token and losses from liquidation fees.
Index x Morpho Leverage Integration
Medium