The settleVaultsDebt()
function incorrectly determines vault debt/credit status by using an inverted comparison operator leading to incorrect asset swaps.
The issue exists in the following code where the debt/credit determination is reversed.
As we can see from the comments, it considers the vault is in credit when the vault's realized debt is greater than zero.
The getUnsettledRealizedDebt()
returns a negative vaule when the vault is in credit, and vice versa.
However, the current implementation treats negative values as debt and positive values as credit, which is incorrect.
The incorrect debt/credit determination leads to wrong asset swaps causing unintended fund movements and potential financial losses.
Update the condition to use gt()
instead of lt()
to correctly identify debt versus credit positions.
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.