The calculateRcrvUSDAmount
function in the StabilityPool
contract incorrectly calculates the amount of rToken to return for a given deToken redemption. The current calculation does not account for the difference in decimals between rToken and deToken, leading to incorrect amounts being returned.
The current calculateRcrvUSDAmount
function in the StabilityPool
contract is:
The current calculation does not correctly account for the difference in decimals between rToken and deToken, leading to incorrect amounts being returned. For example, if rToken has 18 decimals and deToken has 16 decimals, 100 e18 of rToken should equal 100 e16 of deToken. However, based on the current formula, for 100 e16 deToken, it must return 100 e18 rToken, but it returns 100 e14 rToken.
This issue can lead to incorrect amounts of rToken being returned for a given deToken redemption, potentially causing issues with token accounting and user balances within the protocol.
Manual code review.
Update the calculateRcrvUSDAmount
function to correctly account for the difference in decimals between rToken and deToken. The corrected function should be:
This ensures that the correct amount of rToken is returned for a given deToken redemption, leading to accurate token accounting and user balances.
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.