The transferAccruedDust
function in the RToken
contract is not working correctly due to an error in the calculation of the dust amount. The calculation involves multiplying the total supply by the liquidity index twice, leading to an inflated real balance and preventing the correct transfer of dust.
The issue arises in the calculateDustAmount
function, where the totalSupply
is already scaled by the liquidity index. The totalRealBalance
is then calculated by multiplying this already scaled totalSupply
by the liquidity index again. This results in an inflated totalRealBalance
, which is higher than necessary.
For example, if the asset amount is 110 and the scale index is 1.1, the mint amount would be 100, and the total supply would be 110. However, the totalRealBalance
would be calculated as 110 * 1.1, which is higher than it should be. Consequently, the dust amount cannot be transferred correctly.
The incorrect calculation of the dust amount leads to the inability to transfer the actual dust balance
Manual
To fix the issue, adjust the calculation of the totalRealBalance
in the calculateDustAmount
function. Ensure that the totalSupply
is not scaled by the liquidity index more than once.
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.