The wrong implementation in settleVaultsDebt
will actually make the debt even worse.
In the settleVaultsDebt the following operations are performed for each vault:`
Here we can see that if the vault has an unsettled debt which is less than 0 it is assumed to be in debt. However this is actually wrong since a vault is in debt when the realized debt is more than 0.
As a result vaults that are in credit will swap collateral and increase their credit even more, creating the vaultUnsettledRealizedDebtUsdX18 more negative, while vaults that are in debt, will swap their USDC for collateral which will increase their debt drastically.(here we can see that USDC reduces the debt)
The debt cannot be settled because of the wrong checks in the function. With the current implementation if the vault is in credit(which means negative debt), the function will further increase its credit:
While if the vault is in debt, it will become in even more debt.
Manual Review
When a vault is in debt, the vaultUnsettledRealizedDebtUsdX18 is actually positive.
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.