The marketsRealizedDebtUsd represents the total amount of realized debt coming from markets in USD. This value represents the net delta of a market's credit deposits and its net usd token issuance. And depositedUsdc represents the total amount of USDC deposits coming from markets or other vaults to this vault, takes part of the unsettled realized debt value. According to settleVaultsDebt and rebalanceVaultsAssets, the vault is in debt when unsettled debt is negative. But the implementation of Vault::getUnsettledRealizedDebt subtract deposited usdc from realized debt. Deposited usdc is credit where as realized debt from markets is debt.
The correct calculation should deduct marketsRealizedDebtUsd from depositedUsdc:
If depositedUsdc > marketsRealizedDebtUsd, the vault is in credit.
If depositedUsdc < marketsRealizedDebtUsd, the vault is in debt.
Currently it is doing opposite
Wrong calculation of unsettled debt causing no successfull call to settleVaultsDebt and rebalanceVaultsAssets And other functions depending on this will get affected
Deduct marketsRealizedDebtUsd from depositedUsdc:
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.