Adapter's slippage check is not sufficient because it calculates amountOutMinimum
from token prices in same transaction.
CurveAdapter.sol#executeSwapExactInputSingle()
function is as follows.
As we can see above, expectedAmountOut
is calculated from BaseAdapter.sol#getExpectedOutput()
.
From above code, we can see that exectedAmountOut
is calculated from prices.
And then amountOutMinimum
is calculated from this value.
This can cause some problems.
A transaction can be delayed for much time because of some reasons such as gas price.
Then, token prices can be changed more than expected.
In this case, caller will lose funds more than expected.
And difference between token price and pool's current tick will increase probability of DOS.
This problem exists in CurveAdapter, UniswapV2Adapter and UniswapV3Adapter.
A transaction can be delayed for much time because of some reasons such as gas price.
Then, token prices can be changed more than expected.
In this case, caller will lose funds more than expected.
And difference between token price and pool's current tick will increase probability of DOS.
Manual review
Add amountOutMinimum
variable to SwapExactInputSinglePayload
and SwapExactInputPayload
struct.
Modify logics to check slippage with this amountOutMinimum
.
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.