Assessment reports>Y2K Finance>Threat Model>_swapBalancer

Function: _swapBalancer(byte[] swapPayload)

This swaps using the balancerVault.

Inputs

  • swapPayload

    • Constraints: No constraints.

    • Impact: The payload for the swap --- varies by DEX.

Branches and code coverage (including function calls)

Intended branches

  • The function calls the balancerVault with the provided swapPayload.

  • The function checks if the provided selector matches for a single swap or assumes multiswap if not.

  • In case of single swap, returns the decoded uint256 amount of toToken received.

  • In case of multiswap, checks negative asset deltas for received amounts and reverts if none are found.

Negative behavior

  • The function reverts if the balancerVault call is not successful.

Function call analysis

  • balancerVault.call(swapPayload)

    • What is controllable? swapPayload.

    • If return value controllable, how is it used and how can it go wrong? Success used for condition; data used for decoding results.

    • What happens if it reverts, reenters, or does other unusual control flow? This function call can revert if the balancerVault call fails --- no reentrancy scenarios.

Zellic © 2024Back to top ↑