Function: _swap(byte[1] dexId, uint256 fromAmount, byte[] swapPayload)
This uses the dexId
to route the swap to the correct DEX logic.
Inputs
dexId
Constraints: Should be one of 0x01, 0x02, 0x03, or 0x04.
Impact: The
dexId
of the DEX to be used (e.g., 0x01, 0x02, 0x03, or 0x04).
fromAmount
Constraints: No constraints.
Impact: The amount of
fromToken
to be swapped.
swapPayload
Constraints: No constraints.
Impact: The payload for the swap --- varies by DEX.
Branches and code coverage (including function calls)
Intended branches
The function routes the swap based on
dexId
.
Negative behavior
The function reverts if
dexId
is not one of the supported DEX identifiers.
Function call analysis
_swapUniswapV2(0x01/0x02, fromAmount, swapPayload)
What is controllable? 0x01 or 0x02 (from
_swap
),fromAmount
, andswapPayload
.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.
_swapUniswapV3(fromAmount, swapPayload)
What is controllable?
fromAmount
andswapPayload
.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.
_swapWithCurve(swapPayload)
What is controllable?
swapPayload
.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.