A vault is in debt when the unsettled realized debt in usd is less than zero. However in the `VaultRouterBranch` we can see that the opposite is assumed.
In the VaultRouterBranch.sol
we can see several instances in which it is assumed that vault is in credit when it has negative debt:\
Here we can see that this variable is trying to represent the total assets - debt
. However the getVaultCreditCapacity
will actually assume that there is credit, when the debt is negative which is incorrect:
Here we can see that the vault debt will be added instead of removed in the totalAssetsMinusVaultDebtX18
because there will be debt when the vaultDebtInAssetsX18
is negative.
The swap rates will always be wrong.
Manual Review
Change add the vault debt instead of subtracting it.
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.