First Flight #18: T-Swap

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

`TSwapPool::deposit` does not implement the deadline check

Summary

The deposit function has a deadline parameter, which is the deadline for when the transaction is supposed to be completed by. However, this parameter is never used. This means that adding liquidity to the pool might be executed at unexpected times, in market conditions where the deposit rate is unfavorable.

Vulnerability Details

Transactions could be sent when market conditions are unfavorable to deposit, or when the depositor is not wanting those conditions.

Impact

The deadline parameter is unused. This is the output when building the contract:

Unused function parameter. Remove or comment out the variable name to silence this warning.
--> src/TSwapPool.sol:96:9:
|
96 | uint64 deadline
|

Tools Used

--Foundry

Recommendations

It is recommended to implement a check for the deadline parameter

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.