The function getVaultCreditCapacity computes totalAssetsMinusVaultDebtX18 by addding 10^decimalOffset and then subtracting vaultDebtInAssetsX18. The vaultDebtInAssetsX18 can be negative value. So the output totalAssetsMinusVaultDebtX18 can still be zero. This zero output will revert in getVaultAssetSwapRate due to division by zero and getIndexTokenSwapRate will return zero assetsOut
vaultDebtInAssetsX18 can be negative, meaning totalAssetsMinusVaultDebtX18 can still be zero even after adding 10^decimalOffset.
If zero is passed to getVaultAssetSwapRate, it will cause a revert due to division by zero:
In getIndexTokenSwapRate, the output will be zero due to zero multiplication:
getVaultCreditCapacity later converts totalAssetsMinusVaultDebtX18 to uint256:
If totalAssetsMinusVaultDebtX18 is negative, this will revert because converting a negative SD59x18 to uint256 is not possible.
If a vault has more negative debt than total asset in zlpVault, deposit and redeem and other operations will revert and fail, locking funds.
Unexpected reverts in getVaultAssetSwapRate due to division by zero, affecting vault operations.
Check if totalAssetsMinusVaultDebtX18 is zero, if true, add One and then return. If the totalAssetsMinusVaultDebtX18 is less than zero, multiply -1 and then convert it to token decimals
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.