Zaps

Overview

Uniswap V2’s user-friendly codebase has been widely adopted and adapted, influencing numerous networks and derivative projects like Solidly. However, its requirement for liquidity to be added or removed in strict 50/50 ratios has led to a less-than-ideal user experience. In cases where users provide imbalanced ratios, the excess is forfeited, resulting in fewer LP tokens during minting or an enforced 50/50 split upon burning. Odos improves this by accepting any ratio of tokens, converting them efficiently into the most advantageous LP tokens in a single transaction.

Before Odos Zaps

In order to exit a liquidity position and enter a new one, a user must make a minimum of 4 transactions. Below is an example of going from a LP position in Uniswap V2 to another one. For this example, the pools will be WETH/DAI and USDC/UNI

  1. Remove liquidity from WETH/DAI
  2. Swap WETH for UNI
  3. Swap DAI for USDC
  4. Deposit liquidity into USDC/UNI pool

During these transactions, the market may move, or slippage may occur, resulting in less than a 50/50 split of assets.

sequenceDiagram participant User participant UniswapV2Interface participant WETH_DAI_Pool participant USDC_UNI_Pool User->>UniswapV2Interface: Initiate exit from WETH/DAI LP UniswapV2Interface->>WETH_DAI_Pool: Request to remove liquidity WETH_DAI_Pool-->>User: Transfer WETH to user WETH_DAI_Pool-->>User: Transfer DAI to user User->>UniswapV2Interface: Swap WETH for UNI User->>UniswapV2Interface: Swap DAI for USDC User->>UniswapV2Interface: Initiate entry to USDC/UNI LP UniswapV2Interface->>USDC_UNI_Pool: Request to add liquidity USDC_UNI_Pool-->>User: Issue USDC/UNI LP tokens to user

After Odos Zaps

Odos simplifies the process of moving from an LP to another LP, but doing it perfectly and in a single, atomic transaction.

sequenceDiagram participant User participant OdosZapInterface participant WETH_DAI_Pool participant USDC_UNI_Pool Note over User,OdosZapInterface: User wants to switch LP tokens User->>OdosZapInterface: Send original LP tokens (WETH/DAI) OdosZapInterface->>WETH_DAI_Pool: Remove liquidity from WETH/DAI pool WETH_DAI_Pool-->>OdosZapInterface: Return WETH & DAI Note over OdosZapInterface: OdosZapInterface converts tokens OdosZapInterface->>OdosZapInterface: Swap WETH for USDC and DAI for UNI as needed OdosZapInterface->>USDC_UNI_Pool: Add liquidity to USDC/UNI pool USDC_UNI_Pool-->>OdosZapInterface: Mint USDC/UNI LP Tokens Note over OdosZapInterface,User: User receives new LP tokens OdosZapInterface-->>User: Send new LP tokens (USDC/UNI) to User

Supported Pools

Odos Zapping supports Uniswap V2 and Solidly style pools, along with minting and burning of Curve LP tokens for StableSwap pools within the core Odos SOR.

Optimal Rebalancing

Odos strives to distribute your input evenly across a pool’s 50/50 ratio requirement. However, price fluctuations during the transaction can create an imbalance, resulting in a surplus that the pool won’t accept and could be lost. To avoid this, Odos Zaps employ two protective measures:

  1. For standard Uniswap V2 pools: It calculates the exact swap amount to align your contribution with the current pool reserves, optimizing the use of your funds.
  2. For non-standard pools: It can return any surplus tokens to your wallet, ensuring you’re only contributing what’s needed for LP tokens.

Since both options will have a small additional fixed gas cost, they will only be performed if the quantity of wasted assets is above a specified threshold.

Multi-input Zaps

With Odos zapping, users can adjust their investments across several liquidity pools or specific tokens in just one step. This tool is particularly handy for streamlining the process of selling off or reorganizing a set of LP tokens. You can go from many LP positions into a single position or into a combination of tokens.

A summary of what is possible with Odos Zaps:

  • Any number of tokens to a single LP
  • Any number of LPs to a single LP
  • Any number of LPs and tokens to a single LP
  • Any number of LPs and tokens to any number of tokens

Usage

Odos Zaps are accessible through the API and utilize the same smart contract router as the core SOR service. This commonality eliminates the requirement for additional approvals, minimizing security risks. Existing Odos SOR users can conveniently use Odos Zaps to manage their entry into and exit from liquidity positions with ease.

Fees

When using Odos Zaps, the swapMulti function on the router is always employed, incurring a fee of 0.01%. It’s important to note that no additional fees are collected from positive slippage when swapMulti is used.