The mint
function in RToken contract is defined as follows:
As per the function documentation, return values should be :
The problem is that the second return value, which should be the amount of scaled tokens minted (i.e., the amount of RTokens minted), is actually the amount in underlying assets (amountToMint
). Also, the fourth should be the amount in underlying assets but the scaled amount in RToken unit is returned.
This means:
return (isFirstMint, amountToMint, totalSupply(), amountScaled);
in mint
function should be :
return (isFirstMint, amountScaled, totalSupply(), amountToMint);
Consequences of this are wrong data during Deposit
event emission in deposit
function in ReserveLibrary:
We can see that amountScaled
return value (which is actually the amount in underlying asset as we saw previously) is used to set amountMinted
. Then, when emitting Deposit
event, we pass amount
(underlying asset) and amountMinted
(underlying asset). Both are actually the same value.
Also, amountMinted
is returned from deposit
function in ReserveLibrary, but this is incorrect as amountScaled
should be returned (see documentation, deposit
should return "amountMinted: The amount of RTokens minted.").
This means the deposit
function in LendingPool will also emit a wrong Deposit
event (note that the double Deposit
event emission is another issue):
The impact is medium as it leads to incorrect event emission with wrong data, i.e., the amount of RToken minted (scaled amount) is never passed to events. This might break front-end integration.
Manual review.
Make sure to correctly return the amount in underlying asset or in RToken minted. RToken should return:
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.