The burn function in the RToken contract fails to account for accrued interest on a user's existing balance when burning tokens. This omission results in users losing the interest they've earned between their last interaction and the token burn, leading to a direct financial loss.
The burn function in the RToken contract does not calculate or account for the balanceIncrease (accrued interest) on a user's existing balance before burning tokens. This is in contrast to the mint function, which correctly calculates and applies the balanceIncrease for interest accrual. The missing logic in the burn function means that users do not receive the interest they've earned on their deposited assets when they withdraw or burn tokens.
The burn function should calculate the balanceIncrease when the user's last index is less than the current index. This ensures that the user's balance is adjusted by the accrued interest before burning the tokens. The corrected code should look like this:
Initial Deposit:
Alice deposits 100 crvUSD when the liquidity index is 1.0 RAY.
She receives 100 RToken (scaled balance: 100 / 1.0 = 100).
Interest Accrual:
Over time, the liquidity index increases to 1.05 RAY due to interest.
Alice's balance is now 100 * 1.05 = 105 crvUSD (but scaled balance remains 100).
Token Burn:
Alice burns 100 RToken.
Expected Behavior: Alice should receive 100 * 1.05 = 105 crvUSD (scaled to 100 / 1.05 ≈ 95.238). Her balance should be 105 crvUSD.
Actual Behavior: The code burns only 100 RToken (scaled to 95.238), resulting in Alice receiving only 100 crvUSD. The 5 crvUSD interest from her initial deposit is lost.
Result:
Alice's accrued interest (5 crvUSD) is not distributed, causing a loss of funds.
Users lose the interest accrued on their existing deposits when burning tokens, violating the protocol's interest distribution mechanism.
Manual review
Modify the burn function to include the balanceIncrease calculation and adjust the amount accordingly:
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.