Vault's credit capacity is not updated during any usd-token-swap-related activity including getting estimated asset out, initiating swap, fulfilling swap and so on. This will result in user fund loss and protocol fund loss.
Vault's credit capacity (or vault's debt) affects usd token swap rate. However, protocol doesn't use updated vault's credit capacity and total debt when estimating swap result, initiating swap and fulfilling swap.
Is it because protocol always updates vault's credit capacity (i.e. call Vault.recalculateVaultsCreditCapacity
) beforehand? The answer is no. For example:
When perps engine deposit credits to market making engine, vault's credit capacity is not updated
After usd token is issued from market making engine, vault's credit capacity is not updated (only updated before issuing)
When market credit deposits are converted to usdc, vault's credit capacity is not updated either
All of the above actions greatly affects market and its connected vaults' credit capacity and total debt, but the status is not updated afterwards.
Then, can this inconsistency be mitigated by calling updateMarketCreditDelegations
manually from external users?
The answer is no again. Because usd token swap is performed by chainlink's upkeeper. It will be difficult for external users to call this function just before swapping happens.
usd token to asset swap rate depends on premium discount factor, and premium discount factor depends on LTV of the vault. Thus, doing swap operation on obsolete vaules will cause protocol malfunctioning and fund loss
If user gets assets more than deserved as a result of usd-asset swap, it is protocol's and LP's fund loss
If user receives less assets than deserved, it's user's fund loss
If user decided swap parameter from getAmountOfAssetOut
and getFeesForAssetsAmountOut
, which used obsolete values, and then it caused swap failure, then it's both user's fund loss (the user has to pay unwanted protocol fee) and degraded user experience.
Manual Review
Update vault's credit capacity before doing any usd token swap action.
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.