StabilityPool.sol contract allows to set another decimals for tokens (DeCRVUSD and RcrvUSD). But calculateRcrvUSDAmount() calculate it wrongly in case of different decimals between them (let's, 18 and 6)
Function calculateRcrvUSDAmount() looks like this :
To illustrate the point let consider following example :
Rtoken decimals = 6;
Dtoken decimals = 18;
Now scalingFactor = 10e6
But this return (deCRVUSDAmount * getExchangeRate()) / scalingFactor; returns 1e30 precision (when it should 18)
miscalculation of protocol reserves if flexible token decimals feature applied
Manual review
calculate it same way as you do in calculateDeCRVUSDAmount()
Both tokens have 18 decimals. Info
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.