The getAmountOfAssetOut()
and getTotalCreditCapacityUsd()
functions incorrectly handle decimal precision when calculating vault assets in USD by not normalizing the index token's decimals to 18 decimals before multiplication.
The issue occurs in the following code where totalAssets()
returns a value in the index token's native decimals (which can be less than 18) but is directly multiplied with indexPriceX18
(18 decimals):
These functions should convert the index token's totalAssets()
value to 18 decimals before using it in the calculation.
The incorrect decimal handling leads to wrong calculation of asset output amounts during swaps.
Convert the index token's totalAssets()
value to 18 decimals before multiplying with indexPriceX18
like getVaultCreditCapacity().
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.