Summary
deposit
function in LendingPool contract is defined as follows:
function deposit(uint256 amount) external nonReentrant whenNotPaused onlyValidAmount(amount) {
ReserveLibrary.updateReserveState(reserve, rateData);
uint256 mintedAmount = ReserveLibrary.deposit(reserve, rateData, amount, msg.sender);
_rebalanceLiquidity();
emit Deposit(msg.sender, amount, mintedAmount);
}
A Deposit
event is emitted.
The problem is that ReserveLibrary.deposit
call will also ultimately emit an event:
function deposit(ReserveData storage reserve, ReserveRateData storage rateData, uint256 amount, address depositor)
internal
returns (uint256 amountMinted)
{
if (amount < 1) revert InvalidAmount();
updateReserveInterests(reserve, rateData);
IERC20(reserve.reserveAssetAddress).safeTransferFrom(
msg.sender,
reserve.reserveRTokenAddress,
amount
);
(bool isFirstMint, uint256 amountScaled, uint256 newTotalSupply, uint256 amountUnderlying) = IRToken(
reserve.reserveRTokenAddress
).mint(
address(this),
depositor,
amount,
reserve.liquidityIndex
);
amountMinted = amountScaled;
updateInterestRatesAndLiquidity(reserve, rateData, amount, 0);
emit Deposit(depositor, amount, amountMinted);
return amountMinted;
}
Impact
The impact of this issue is low as it leads to incorrect event emission (double deposit emission) which might cause front-end integration issues.
Tools Used
Manual review
Recommendations
Make sure to emit only one Deposit
event when depositing reserve tokens in the lending pool: