The function Market::isAutoDeleverageTriggered will revert when calculating marketDebtRatio if totalDebtUsdX18 is negative. Since totalDebtUsdX18 is of type SD59x18, it can hold negative values. When it is negative, the function attempts to divide by delegatedCreditUsdX18 and convert the result to UD60x18 (unsigned type), causing a reversion due to underflow.
totalDebtUsdX18 is of type SD59x18, which can be negative. The division operation totalDebtUsdX18 / sdDelegatedCreditUsdX18 can result in a negative value. The function then attempts to convert a negative value into UD60x18 (unsigned), which will cause a revert.
ADL cannot function properly if this function reverts unexpectedly
The engines will not be able to call withdrawUsdTokenFromMarket and mint usd token when totalDebtUsdX18 is negative creating a DoS situation
Convert the SD59x18 value to a positive value first before mathematical operation
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.