compound-finance / compound-protocol

The Compound On-Chain Protocol
https://compound.finance/developers
BSD 3-Clause "New" or "Revised" License
1.89k stars 1.21k forks source link

Clarified the precision of exchangeRate within comments. #167

Closed sbaichwal closed 3 years ago

sbaichwal commented 3 years ago

Changed comment describing exchangeRate scaling factor from 1e18 to 10^(18-8+Underlying Token Decimal).

jflatow commented 3 years ago

This isn't quite right and also we wouldn't change the comments on already deployed contracts. But to explain: the exchange rate is somewhat arbitrary, and although its interpretation will depend on the decimals of the cToken and the decimals of the underlying, once you have a desired initial exchange rate, the mantissa is simply scaled by 1e18.