Function: _executeSwap(address[] path, address[] pairs, uint256[] amounts)
This executes swaps on the UniswapV2 fork.
Inputs
path
Constraints: No constraints.
Impact: The array of token addresses to swap between.
pairs
Constraints: No constraints.
Impact: The array of pairs to swap through.
amounts
Constraints: No constraints.
Impact: The array of amounts to swap with each pair.
Branches and code coverage (including function calls)
Intended branches
The function correctly swaps tokens through the specified pairs.
The swap logic works as expected for multiple pairs or a single pair,
Function call analysis
IUniswapPair(pairs[0]).swap(zeroForOne ? 0 : amounts[0], zeroForOne ? amounts[0] : 0, pairs[1], "")
What is controllable?
pairs[0]
,zeroForOne
,amounts[0]
, andpairs[1]
.If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.
IUniswapPair(pairs[i]).swap(zeroForOne ? 0 : amounts[i], zeroForOne ? amounts[i] : 0, pairs[i + 1], "")
What is controllable?
pairs[i]
,zeroForOne
,amounts[i]
, andpairs[i + 1]
.If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.
IUniswapPair(pairs[pairs.length - 1]).swap(zeroForOne ? 0 : amounts[pairs.length - 1], zeroForOne ? amounts[pairs.length - 1] : 0, address(this), "")
What is controllable?
pairs[pairs.length - 1]
,zeroForOne
, andamounts[pairs.length - 1]
.If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.