> For the complete documentation index, see [llms.txt](https://docs.tetu.io/tetu-io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tetu.io/tetu-io/tetu-v1/yield-farm/tetu-zap-solution.md).

# Tetu Zap Solution

### Zapping

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

![](/files/UaFJcUfftmCVN8Ltvc0D)

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.

{% hint style="info" %}
The zapping function can cause slippage, when using it it is better to prioritize small amounts of deposits and withdrawals.
{% endhint %}

### Contracts

This solution included three contracts

* PriceCalculator
* MultiSwap
* ZapContract

### PriceCalculator  <a href="#pricecalculator" id="pricecalculator"></a>

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)`

### MultiSwap  <a href="#multiswap" id="multiswap"></a>

This contract has two purposes:

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

&#x20; `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)`

### ZapContract  <a href="#zapcontract" id="zapcontract"></a>

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

### Resources

Zap Feature article on [Medium](https://medium.com/@tetu.finance/zap-feature-bc43dba8b0f8).
