Function: swapMultiPermit2(permit2Info permit2, inputTokenInfo[] inputs, outputTokenInfo[] outputs, uint256 valueOutMin, byte[] pathDefinition, address executor, uint32 referralCode)
The multiswap variant of swapPermit2. This function performs multiple swaps by utilizing PermitBatchTransferFrom and permitTransferFrom with a signature from the owner of the tokens, instead of using the regular safeTransferFrom.
Inputs
permit2Control: Arbitrary.
Constraints:
signaturemust be a valid signature for assets owned bymsg.senderfor the given nonce, deadline, andtransferDetails.Impact: Specifies the deadline, nonce, and signature used to validate the rest of the parameters.
inputsControl: Arbitrary.
Constraints: The sum of all
inputs[i].amountInmust be equal tomsg.valuein the case of ETH. Cannot have duplicate sources.Impact: Decides token addresses to swap from, the amounts to swap, and the receiver.
outputsControl: Arbitrary.
Constraints: Cannot be equal to any of the input token addresses (arbitrage) or have duplicates of destinations.
Impact: Specifies the output tokens, receiver, and
relativeValue— which is a weighting for slippage calculations.
valueOutMinControl: Arbitrary.
Constraints: Must be larger than 0.
Impact: Decides the minimum value the token owner will allow with respect to slippage.
pathDefinitionControl: Arbitrary.
Constraints: None.
Impact: Passed to the executor — determines the operation to be executed.
executorControl: Arbitrary.
Constraints: None.
Impact: Determines the address of the executor to be invoked.
referralCodeControl: Arbitrary.
Constraints: None.
Impact: Referral code used for statistics and referral fees.
Branches and code coverage (including function calls)
Intended branches
Swapping ETH to tokens.
Swapping tokens to ETH.
Swapping multiple tokens.
Negative behavior
Execution is reverted if
msg.value == expected_msg_value.Same negative coverage as
swapMulti().
Function call analysis
swapMultiPermit2 -> _swapMultiWhat is controllable? All arguments.
If return value controllable, how is it used and how can it go wrong? Not used.
What happens if it reverts, reenters, or does other unusual control flow? Reverts are not caught and will make the entire swap revert.
swapMultiPermit2 -> permitTransferFromWhat is controllable? All arguments, except owner, which is always
msg.sender.If return value controllable, how is it used and how can it go wrong? Not used.
What happens if it reverts, reenters, or does other unusual control flow? Reverts are not caught and will make the entire swap revert.