Market's totalDelegatedCreditUsd
may be outdated when credit is added by registered engine.
When a registered engine calls depositCreditForMarket() to add credit in form of a registered collateral type, if the collateral is USDC, settleCreditDeposit() is called to update the amount of usdc available to be distributed to vaults delegating credit to this market.
CreditDelegationBranch::depositCreditForMarket():
In settleCreditDeposit()
, market's totalDelegatedCreditUsd
is used to calculate the usdc that has been accumulated per usd of credit delegated to the market.
Market::settleCreditDeposit():
Market's totalDelegatedCreditUsd
is calculated based on the vault's total credit capacity and is updated in recalculateVaultsCreditCapacity().
Vault::_updateCreditDelegations():
The problem is that recalculateVaultsCreditCapacity()
is not called when the registered engine adds credit in depositCreditForMarket()
, it is possible that the market's totalDelegatedCreditUsd
is outdated by then, due to the vault's total credit capacity which can also be outdated:
depositCreditForMarket()
is called by other engine before, market's usdcCreditPerVaultShare
changed;
Vault's total credit capacity depends on market's usdcCreditPerVaultShare
change, but becaues recalculateVaultsCreditCapacity()
is not called, the credit capacity is not up to date, therefore it is outdated.
Outdated market's totalDelegatedCreditUsd
is used when registered engines add credit, results in the credit deposit is not properly settled.
Manual Review
Call recalculateVaultsCreditCapacity()
when the registered engine adds credit.
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.