The vault credit capacity calculation uses unadjusted collateral price while the debt calculation uses adjusted price, leading to incorrect capacity values.
In getVaultCreditCapacity(), the function uses unadjusted assetPriceX18 to convert debt to asset amount, while the debt value itself is calculated using adjusted price:
The debt value vaultDebtUsdX18 comes from a chain of function calls:
getTotalDebt() calls getUnsettledRealizedDebt.
getUnsettledRealizedDebt() uses marketsRealizedDebtUsd which is updated in _recalculateConnectedMarketsState().
The debt value originates from Market's getCreditDepositsValueUsd() which uses adjusted price.
The inconsistent price usage leads to incorrect vault credit capacity calculation which affects token swap rates during redemptions.
Use adjusted collateral price instead of unadjusted price when calculating vault credit capacity.
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.