Function: _swap(address fromToken, address toToken, address pool, int128 i, int128 j, uint256 fromAmount, uint256 toAmountMin)
This swaps on Curve with the logic for an ERC-20 pool.
Inputs
fromToken
Constraints: No constraints.
Impact: The token being swapped from.
toToken
Constraints: No constraints.
Impact: The token being swapped to.
pool
Constraints: No constraints.
Impact: The Curve pool being swapped with.
i
Constraints: No constraints.
Impact: The index of the
fromToken
in the Curve pool.
j
Constraints: No constraints.
Impact: The index of the
toToken
in the Curve pool.
fromAmount
Constraints: No constraints.
Impact: The amount of
fromToken
to swap.
toAmountMin
Constraints: No constraints.
Impact: The minimum amount of
toToken
to receive from the swap.
Branches and code coverage (including function calls)
Intended branches
The swap on Curve succeeds with the given parameters.
Negative behaviour
The swap on Curve fails if output tokens are less than
toAmountMin
.
Function call analysis
ERC20(fromToken).safeApprove(pool, fromAmount)
What is controllable?
fromToken
,pool
, andfromAmount
.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.
ERC20(toToken).balanceOf(address(this))
What is controllable?
toToken
.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.
ICurvePair(pool).exchange(i, j, fromAmount, toAmountMin)
What is controllable?
pool
,i
,j
,fromAmount
, andtoAmountMin
.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.