In RToken
, the burn
function is responsible for facilitating the withdraw of a user by burning their rTokens
in exchange for crvUSD
/ reserveToken.
But when a user tries to withdraw their entire balance, it will fail because the burn
amount is never scaled while their balance of reserveToken
increases. So the user will not have enough rTokens
balance to burn and it will revert.
The amount
used for both burning rTokens
and transferring reserveToken
is the scaled total balance the user has which is a larger number than the actual balance becasue it represents the increase in value from interest that has accumulated. So the user wont have enough rTokens
in their actual balance to burn.
The user wants to withdraw all of their balance, so they input a number they think represents the total balance they have plus the interest they earned. IF this number is larger than their actual balance the amount
will be set to userBalance
. That is the scaled balance which includes the increase in value from interest accumulation.
The userBalance
represents the total value of reserveToken
that their balance of rToken
now represents becasue of the accrual of interest. So this number is larger than their actual balance of rToken
.
_burn
attempts to burn the scaled amount userBalance
which is greater than the actual balance of rToken
-> and it fails.
The transfer of reserveToken
never happens becasue of the failed burn.
The scaled userBalance
is the balance of reserveTokens
the user should receive because it represents the total value + the interest they have earned. This value is correct as the user should receive their total balance and the interest they have accrued.
The problem is because the amount burned in _burn
is never scaled to represent the appreciated value of the rToken
. The amount of rTokens
burned should be less because it has gotten stronger, as such, the user should burn their total actual balance of rTokens
-> and receive the scaled userBalance
.
That would function as intended which rewards the user with their earned interest, while burning all of their rTokens, completing a full withdraw.
User unable to withdraw their total balance, and will have to withdraw piece by piece or not be able to get all of their balance back.
manual review
Scale the amount of rTokens
to be burned, to represent the growth in strength, which will allow the correct amount of rTokens to be burnt and the user to burn all of their rTokens
to redeem all of their balance.
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.