Incorrect application of premiumDiscountFactor
in StabilityBranch.getAssetAmountOut
, premiumDiscountFactor
will inflate the amount of collateral amount out, effectively drain the vault.
In StabilityBranch.getAmountOfAssetOut
, premiumDiscountFactor
is getting multiplied, instead of being divided
Let's see why premiumDiscountFactor
should be divided.
UsdTokenSwapConfig.getPremiumDiscountFactor
logic can be formalized in the following way:
: vaultAssetsValueUsd
: vaultDebtUsd
: vaultDebtTvlRatioAbs
: premiumDiscountFactor
According to the following comment:
we can derive the following:
So for , .
This means for vaults with LTV = 0.8, collateral mount to be returned for 1 USD is inflated by 10 times.
This is the opposite of the purpose of premiumDiscountFactor
.
If it was a division, collateral amount will be deflated by 1/10, which will effectively guard against asset draining during high LTV.
Vaults can be easily drained once its LTV is greater than
Foundry, Manual Review
Should be fixed in the following way:
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.