In the current implementation of depositCreditForMarket, there is a missing call to recalculateVaultsCreditCapacity. This omission results in stale values for totalDelegatedCreditUsd, leading to incorrect calculations of usdcCreditPerVaultShare. Since the vaults of a market can accumulate more or less delegated credit over time, failing to update totalDelegatedCreditUsd before using it introduces inaccuracies.
A user calls depositCreditForMarket with USDC as the deposit asset.
The function attempts to calculate usdcCreditPerVaultShare based on totalDelegatedCreditUsd.
However, totalDelegatedCreditUsd has not been updated—it may not reflect the latest state of the vaults.
This results in an incorrect credit per share calculation, which can impact credit distribution logic.
Incorrect Credit Accounting: Since usdcCreditPerVaultShare relies on totalDelegatedCreditUsd, using stale values can distort credit distribution across vaults.
Potential Financial Imbalance: Some vaults may receive more or less credit than they should
Manual review
To ensure totalDelegatedCreditUsd is up to date before computing usdcCreditPerVaultShare, insert a call to Vault.recalculateVaultsCreditCapacity() at the beginning of depositCreditForMarket:
This change ensures that totalDelegatedCreditUsd always reflects the latest vault state, preventing incorrect credit calculations.
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.