Function: swapRouterFunds(inputTokenInfo[] inputs, outputTokenInfo[] outputs, uint256 valueOutMin, byte[] pathDefinition, address executor)
This function allows the contract owner to swap the funds owned by the router (originating from fees and positive slippage).
Inputs
inputs
Control: Arbitrary.
Constraints: None.
Impact: Specifies the address and amount of the tokens to be used as input as well as the recipient of the transfer.
outputs
Control: Arbitrary.
Constraints: None.
Impact: Specifies the address, relative value, and recipient of the output tokens.
valueOutMin
Control: Arbitrary.
Constraints: None.
Impact: Specifies the value compared against the sum of relative values of the outputs for slippage protection.
pathDefinition
Control: Arbitrary.
Constraints: None.
Impact: Passed to the executor, specifies the operation to be performed.
executor
Control: Arbitrary.
Constraints: None.
Impact: Specifies the address of the executor.
Branches and code coverage (including function calls)
We note that only a few basic tests for this function are performed.
Intended branches
Transfers the inputs, invokes the executor, performs slippage checks, and transfers the outputs.
Negative behavior
Reverts if the slippage is too high.
Reverts if the caller is not the owner.
Function call analysis
rootFunction -> _universalBalance(tokensIn[i])
What is controllable? The address argument.
If return value controllable, how is it used and how can it go wrong? Controllable by specifying an arbitrary token, but this control has no meaningful use.
What happens if it reverts, reenters, or does other unusual control flow? Reverts are propagated upwards. Reentrancy is possible but not exploitable.
rootFunction -> _universalTransfer(tokensIn[i], ...)
What 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 propagated upwards. Reentrancy is possible but not exploitable.
rootFunction -> balancesBefore[i] = _universalBalance(tokensOut[i])
What is controllable? The address argument.
If return value controllable, how is it used and how can it go wrong? Controllable by specifying an arbitrary token, but this control has no meaningful use.
What happens if it reverts, reenters, or does other unusual control flow? Reverts are propagated upwards. Reentrancy is possible but not exploitable.
rootFunction -> IOdosExecutor(executor).executePath
What 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 propagated upwards. Reentrancy is possible but not exploitable.
rootFunction -> amountsOut[i] = _universalBalance(tokensOut[i])
What is controllable? The address argument.
If return value controllable, how is it used and how can it go wrong? Controllable by specifying an arbitrary token, but this control has no meaningful use.
What happens if it reverts, reenters, or does other unusual control flow? Reverts are propagated upwards. Reentrancy is possible but not exploitable.
rootFunction -> _universalTransfer(outputs[i].tokenAddress, ...)
What 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 propagated upwards. Reentrancy is possible but not exploitable.