Open code423n4 opened 2 years ago
Known issue, prevents certain combinations of tokens from being deployed. No high risk as no deployment will occur. No funds at risk, no incorrect functionality. Low at best.
This hasn't been listed as a known issue so it can't be marked invalid but since deployments can't occur, it's a medium severity.
Lines of code
https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L539
Vulnerability details
Impact
Decimals limitation limits the tokens that can be used.
Proof of Concept
Let's give some name to the decimals of certain numbers: n = decimals of numerator oracle. d = decimals denominator oracle. a = decimals of the asset. c= decimals of the collateral.
now, the
oracleNormalization = 10 ^(18 + n - d + a - c)
. And here: https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L536 ,price
has decimals of36 + n -d
, so here() when we calculate_exchangeRate = _price / oracleNormalization;
it would underflow and revert ifa >18 +c
. And that's a pretty big limitation on the tokens options. We have USDC which have 6 decimals so all the tokens the their decimals < 24 are not possible to use in this system (with USDC together).Tools Used
Recommended Mitigation Steps