Tetu Zap Solution


Zap solution converts a token to another using a defined route and can be used to deposit or withdraw from a vault.

Through the Zapping Function users can enjoy the efficiency of participating in a yield farming vault with just one transaction, in general with zapping users can perform only one transaction to enter and exit a yield farming vault. Without using zapping the user would have to perform between 6 ~ 8 transactions to deposit to a yield farming vault.

Withdraw and converting to the token is also possible.

The zapping function can cause slippage, when using it it is better to prioritize small amounts of deposits and withdrawals.


This solution included three contracts

  • PriceCalculator

  • MultiSwap

  • ZapContract


In this solution Price Calculator will find the best liquidity pool across predefined Swap Platforms.

getLargestPool(address token, address[] memory usedLps)

For calculation price for any LiquidityPool pair using

getPriceFromLp(address lpAddress, address token)


This contract has two purposes:

Find the best route for swap two tokens. The result will contain swap pairs.

findLpsForSwaps(address _tokenIn, address _tokenOut)

The function should be called as a view from UI before the swap

Multi-swap will execute swaps for a given route. Used inside ZapContract but also can be used as a dedicated solution.

multiSwap(address[] memory lps, address tokenIn, address tokenOut, uint256 amount, uint256 slippageTolerance)


This contract implements all required steps for deposit/withdraw to the vault.


Zap Feature article on Medium.

Last updated