Open code423n4 opened 3 years ago
cmichel
In ._totalAssetsEmergency there's a loss of precision in the assets computation due to first truncating by the chainlink decimal factor and then multiplying by DEFAULT_DECIMALS_FACTOR afterwards.
._totalAssetsEmergency
assets
DEFAULT_DECIMALS_FACTOR
assets = assets.mul(price).div(CHAINLINK_PRICE_DECIMAL_FACTOR); assets = assets.mul(DEFAULT_DECIMALS_FACTOR).div(decimals);
There can be a loss of precision in the computations.
Multiply by DEFAULT_DECIMALS_FACTOR first before dividing by CHAINLINK_PRICE_DECIMAL_FACTOR
CHAINLINK_PRICE_DECIMAL_FACTOR
No any precision loss. The 1st line is the token amount, the 2nd line is the dollar amount.
Technically warden is right but I doubt there will be any precision loss in practice. I'll keep it as non-critical.
Handle
cmichel
Vulnerability details
Vulnerability Details
In
._totalAssetsEmergency
there's a loss of precision in theassets
computation due to first truncating by the chainlink decimal factor and then multiplying byDEFAULT_DECIMALS_FACTOR
afterwards.Impact
There can be a loss of precision in the computations.
Recommended Mitigation Steps
Multiply by
DEFAULT_DECIMALS_FACTOR
first before dividing byCHAINLINK_PRICE_DECIMAL_FACTOR