20,000 USDC
View results
Submission Details
Severity: gas
Valid

Lender.sol - use pull for feeReceiver

Summary

borrow() calls could be blocked if feeReceiver cannot receive the fees.

Vulnerability Details

It's important to ensure that the contract functionality cannot be blocked by external entities.

Impact

The contract won't work as expected

Tools Used

Manual Review

Recommendations

Accumulate the fees in the contract and force feeReceiver to call a new function getFees() to transfer the balance.

mapping(address feeTokenAddress => uint256 feeBalance) public acumulatedFees;
event FeesTrannsferred(address indexed feeToken, uint256 amount);
function getFees(address _feeTokenAddress) external onlyFeeReceiver {
uint256 balance = acumulatedFees[_feeTokenAddress];
IERC20(_feeTokenAddress).safeTransfer(feeReceiver, balance);
acumulatedFees[_feeTokenAddress] -= amount;
emit FeesTrannsferred(_feeTokenAddress, amount);
}

Support

FAQs

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