The executeSwapExactInput
function in the CurveAdapter
contract calculates slippage tolerance (amountOutMinimum
) for each intermediate swap step in a multi-hop swap path. This approach leads to cumulative slippage, where the overall slippage exceeds the intended tolerance. For example, if the slippage tolerance is 1% and the swap path is USDT -> WETH -> USDC
, the final output could be 98.01 USDC for an input of 100 USDT, resulting in an effective slippage of 1.99% instead of the intended 1%.
The executeSwapExactInput
function calculates the minimum acceptable output (amountOutMinimum
) for each intermediate swap step using the calculateAmountOutMin
function.
For example, in a path like USDT -> WETH -> USDC
:
First swap: 100 USDT -> 0.03 WETH (Let's say the 0.03 WETH is now equal to 99 USD, so this is 1% slippage).
Second swap: 0.03 WETH -> 98.01 USDC (1% slippage).
The final output is 98.01 USDC, which represents a total slippage of 1.99%.
Since slippage is applied at each step, the overall slippage accumulates, leading to a higher effective slippage than intended.
Users may receive significantly less output than expected due to cumulative slippage. The slippage tolerance mechanism fails to provide the intended protection against price fluctuations.
The impact is Medium, the likelihood is Medium, so the severity is Medium.
Manual Review
To fix this issue, the slippage tolerance should be calculated based on the entire swap path's expected output. Consider following code example:
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.