The Vault's design was heavily optimized for swaps with two key points in mind:

  1. Extremely low gas costs
  2. Flexibility (i.e. complex paths, joins as part of swap, etc.)

The chart below highlights the results of these design decisions.

Swap Gas Cost Comparison

Swap Types

The Vault has two core types of swaps: Single Swaps and Batch Swaps. As the names imply, Single Swap is used when only swapping 2 tokens against a single pool. And Batch Swap, the more commonly used one, allows for multiple hops, paths, and pools. This differentiation allows for the Single Swap to be even more gas optimized and can be as low as 95k for a swap.

Developer Reference

Developers can check out the BatchSwap and SingleSwap reference pages to learn more.