The goal of the _calculate_health_factor
function is to compute the health factor of a position in a decentralized finance (DeFi) system. This health factor is crucial for determining the safety and risk level of a user's collateralized position. But there is only an implementation for WETH, there is none for WBTC.
In function is calculation of health factor only for WETH. But protocol has also possibility to deposit WBTC.
There is multiplication of collateral_adjusted_for_threshold with 10**18.
10^18 it is value for WETH; 1 ETH == 10^18 WEI.
In the scope of WETH is good, but for WBTC is wrong. Because for BTC the smolest unit is satoshi, which is equal
1BTC = 10^8 satoshi.
There is an incorrect multiplier for BTC, and due to this vulnerability, if you try to deposit 1 BTC, WBTC's value is erroneously amplified by 10^10 times.
There is an incorrect multiplier for BTC, and due to this vulnerability, if you try to deposit 1 BTC, WBTC's value is erroneously amplified by 10^10 times.
A vulnerability with an incorrect multiplier for BTC could lead to significant issues for the protocol by overestimating the value of minted DSC.
manual review
You can add if statement to check WBTC or WETH type for set specific precision.
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.