Underflow in UsdTokenSwapConfig.getPremiumDiscountFactor
will prevent users from swapping USD token to collateral when vault's credit / vaule ratio is above certain threshold.
UsdTokenSwapConfig.getPremiumDiscountFactor
logic can be formalized in the following way:
: vaultAssetsValueUsd
: vaultDebtUsd
: vaultDebtTvlRatioAbs
: premiumDiscountFactor
According to the following comment:
we can derive the following:
Thus, when and ,
$f(x) = 1 - y = 1 - (9 * \Delta x ^ 3) $
which will cause underflow in ud60x18 math for certain
Users will be prevented from swapping USD token to underlying collateral for vaults in credit
Manual Review, Foundry
We need to ensure never grows more than 1.
The upper limit of is , because
and since ,
thus
So we need to ensure is set to be lower than 1
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.