The deadline
that is passed to swap functions is a storage variable with a setter function. To achieve reasonable deadline
for swaps at all times will require calling the setter function almost every hour. If not the deadline will need to be set to a very high amount as deadline.
Passing very high deadline defeats the purpose of the deadline protection. Even Uniswap app considers a deadline of 1 hour as high deadline.
The deadline
is that is passed to the swap functions in UniswapV2Adapter.sol
and UniswapV3Adapter.sol contracts is a storage variable in the inherited BaseAdapter.sol. This deadline storage variable has a setter function that onlyOwner can call.
Due to the reasons stated in the Impact section below, this approach is limits flexibility for reasonable deadline for all swap transactions at all times.
If small
deadline
is updated from time to time, transactions after that deadline will fail causing denial of service until a new deadline is updated. And this cause more gas.
If large
deadline
is passed, the purpose of deadline
protection is deafeated. The deadline protects swap transactions from being held for too long until it is profitable to exploit through sandwich attack.
Manual Review
Consider passing deadline
as input to the swap functions which can be calculated on the frontend for every separate swap transaction.
The frontend can get the unix timestamp
then add 30 minutes to it to get a deadline
at the point of sending the transaction.
Unix timestamp
+ 1800 seconds
= deadline
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.