Function: withdrawAlternative(address token, address to, uint256 amount, uint8 mode)
Allows to withdraw assets from the vault; in case an ETH/WETH withdrawal is requested, allows to specify whether the output should be ETH or WETH.
Inputs
tokenControl: Arbitrary.
Constraints: None.
Impact: Determines the asset to be transferred.
toControl: Arbitrary.
Constraints: None.
Impact: Determines the recipient of the withdrawal.
amountControl: Arbitrary.
Constraints:
balances[token][msg.sender] >= amount.Impact: Determines the amount to be transferred.
modeControl: Arbitrary.
Constraints: None.
Impact: Determines the behavior of ETH/WETH transfers.
Branches and code coverage (including function calls)
Intended branches
Handles ERC20 withdrawals.
Handles ETH mode 2 withdrawals (wraps and transfers WETH).
Handles ETH mode 0/1 withdrawals (transfers ETH).
Handles WETH mode 1 (transfers ETH).
Handles WETH mode 0/2 (transfers WETH).
Negative behavior
Reverts if user balance is insufficient.
Function call analysis
External calls have the same profile of transfer.