In the _swapUnderlyingToAsset
function, the strategy uses block.timestamp
as the deadline parameter for the swapExactTokensForTokens
function:
Using block.timestamp
without adding a time buffer can lead to swaps failing if the transaction is mined in the next block after the one in which it was submitted. This can cause operational issues and prevent swaps from occurring as intended.
Failed Transactions: Swaps may fail unexpectedly due to strict timing, leading to wasted gas fees and delays in strategy operations.
Operational Inefficiency: Frequent transaction failures can hinder the strategy's performance and responsiveness.
Potential Loss of Opportunities: Missing timely swaps may result in lost opportunities to capitalize on favorable market conditions.
Scenario:
The swapExactTokensForTokens
call is included in a block mined after the current block.
The block.timestamp
has advanced beyond the specified deadline.
Effect:
The swap fails due to the exceeded deadline.
The transaction reverts, incurring gas costs without achieving the desired outcome.
Consequence:
Operational delays as the swap must be retried.
Increased gas costs due to failed transactions.
Add a Time Buffer to Deadlines:
Include a reasonable time buffer when setting the deadline to allow for transaction mining delays.
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.