The settleVaultsDebt()
function in the vault management system attempts to swap the vault's assets for USDC
to cover any unsettled debt. However, there is a risk that the calculated swap amount may exceed the actual available assets in the vault, leading to potential transaction failures as this is not handled gracefully.
In the current implementation, the function calculates the amount of assets to swap using the calculateSwapAmount()
function. This calculated swapAmount
is then used in the _convertAssetsToUsdc()
function to approve
and execute the swap.
Notice that within the _convertAssetsToUsdc()
, the dexAdapter
is approved to spend the swapAmount
calculated above:
If the swapAmount
exceeds the vault's available assets, the approval will fail when the dexAdapter
attempts to pull this amount, resulting in a transaction failure.
If the calculated swapAmount
exceeds the available assets in the vault, the transaction will fail. This could lead to a situation where the vault remains in debt, as the intended asset conversion to cover the debt would not occur.
Manual Review
Implement a mechanism to use the available assets amount if it cannot fully clear the debt.
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.