First Flight #18: T-Swap

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

`TSwapPool::deposit`is missing deadline check causing transactions to complete even after the deadline

Summary

TSwapPool::depositis missing deadline check causing transactions to complete even after the deadline

Vulnerability Details

The deposit function includes a deadline parameter, which is documented as "The deadline for the transaction to be completed by." However, this parameter is not utilized within the function. As a result, operations that add liquidity to the pool may be executed at unintended times, potentially under market conditions that are unfavorable for the deposit rate.

Impact

Transactions could be executed under adverse market conditions, leading to unfavorable deposit rates, even when a deadline parameter is specified. This misalignment can cause financial losses or missed opportunities for users expecting their transactions to occur within a specified time frame.

Tools Used

Manual review

Recommendations

To ensure the deadline parameter is honored, the function should include a check to revert the transaction if the current time has surpassed the specified deadline. This can be implemented by adding a call to revertIfDeadlinePassed(deadline) within the function. The updated function is shown below:

function deposit(
uint256 wethToDeposit,
uint256 minimumLiquidityTokensToMint, // LP tokens -> if empty, we can pick 100% (100% == 17 tokens)
uint256 maximumPoolTokensToDeposit,
uint64 deadline
)
external
+ revertIfDeadlinePassed(deadline)
revertIfZero(wethToDeposit)
returns (uint256 liquidityTokensToMint)
Updates

Appeal created

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

`deposit` is missing deadline check causing transactions to complete even after the deadline

Support

FAQs

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