Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

RToken::rescueToken() can never be called

Description

Inside RToken.sol, the emergency function rescueToken() has a onlyReservePool modifier which restricts its call to be made only by the LendingPool contract and no one else.

File: contracts/core/tokens/RToken.sol
337:@---> function rescueToken(address tokenAddress, address recipient, uint256 amount) external onlyReservePool {
338: if (recipient == address(0)) revert InvalidAddress();
339: if (tokenAddress == _assetAddress) revert CannotRescueMainAsset();
340: IERC20(tokenAddress).safeTransfer(recipient, amount);
341: }

However there is no function inside LendingPool.sol that calls the aforementioned function. There is one there named rescueToken() but that rescues funds from the LendingPool contract, not the RToken one.

Impact

The functionality which RToken::rescueToken() aims to provide can never be used. Any stuck funds can never be rescued.

Mitigation

Add a function inside LendingPool.sol which looks like this:

function rescueTokenFromRTokenContract(address tokenAddress, address recipient, uint256 amount) external onlyOwner {
require(amount > 0);
IRToken(reserve.reserveRTokenAddress).rescueToken(tokenAddress, recipient, amount);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RToken::rescueToken() can never be called

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.