The RToken contract contains unused variables and dead code that should be removed for efficiency and clarity.
_liquidityIndexDefined as uint private _liquidityIndex;
Initialized in the constructor with _liquidityIndex = WadRayMath.RAY;
Can be updated using updateLiquidityIndex, but this function is never called.
Used in transferFrom, but it has no impact since it is always equal to WadRayMath.RAY, which is simply the multiplication unit in WadRayMath.
_userState_userState is a struct that tracks an index.
Since index tracking is already managed centrally by LendingPool.reserve, storing liquidity/usage index here is redundant.
mint()The following code fragment attempts to track balance increases but is redundant since all scaling happens in _update().
Remove this code.
burn()The following line in burn() is unnecessary, as scaling is already handled in _update():
Remove this code.
_minter & _burnerMinting and burning are managed by LendingPool, making _minter and _burner redundant.
The following should be removed:
_minter and _burner variables.
Any functions associated with these roles.
From project documentation (/docs/core/tokens/RToken.md):
Reduces gas costs and contract size by removing unnecessary storage variables and redundant code.
Improves readability and maintainability by eliminating dead code.
Manual code review
Remove _liquidityIndex, _userState, _minter, _burner, and associated unused functions.
Remove dead code from mint() and burn().
Ensure that LendingPool fully manages minting, burning, and index updates.
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.