First Flight #18: T-Swap

First Flight #18
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Event `LiquidityAdded` in `TSwapPool::_addLiquidityMintAndTransfer` has its log values emitted in wrong order, which could affect any offchain functions associated to this event log data

Summary

The log values emitted by event LiquidityAdded in TSwapPool::_addLiquidityMintAndTransfer was found in wrong order. Parameter poolTokensToDeposit should be placed in third position whilst wethToDeposit should be brought forward to second position. The wrong order in the emitted event could affect any offchain functions that rely on these values for further processing

Vulnerability Details

The event LiquidityAdded emitted via TSwapPool::_addLiquidityMintAndTransfer has its parameters poolTokensToDeposit and wethToDeposit placed in wrong order. poolTokensToDeposit should be placed at third position whilst wethToDeposit should be brought forward to second position.

Impact

Any offchain functions that rely on these values for further processing will be affected resulting inaccuracy, malfunctions and/or confusion to user

Tools Used

Manual review

Recommendations

Make correction to the event parameter as follows:

function _addLiquidityMintAndTransfer(
uint256 wethToDeposit,
uint256 poolTokensToDeposit,
uint256 liquidityTokensToMint
) private {
_mint(msg.sender, liquidityTokensToMint);
- emit LiquidityAdded(msg.sender, poolTokensToDeposit, wethToDeposit);
+ emit LiquidityAdded(msg.sender, wethToDeposit, poolTokensToDeposit);
// Interactions
i_wethToken.safeTransferFrom(msg.sender, address(this), wethToDeposit);
i_poolToken.safeTransferFrom(
msg.sender,
address(this),
poolTokensToDeposit
);
}
Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`LiquidityAdded` event has parameters out of order

Support

FAQs

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