# Zapper Contract

This contract enables users to invest in and withdraw from a DeFindex Vault withouyt needing to hold the exact required set of assets of the vault.

For instance, if a DeFindex Vault requires both USDC and XLM in a defined ratio, the Zapper contract allows users to inpu USDC, automatically swapping the USDC for XLM and depositing both assets into the DeFindex Vault according to a predefined ratio. Similarly, the Zapper contract facilitates withdrawals by swapping the XLM back to USDC before returning the funds to the user.

The specific paths used for asset swaps, as well as the proportion of the output assets, are determined off-chain.

### Functions

* `deposit`: Allows users to deposit assets into the DeFindex Vault.
* `zap`: Allows users to deposit assets into the DeFindex using a single asset. This function receives the amount of one asset and an array of Soroswap's Aggregator Swap transactions. This array is computed offchain using the best path and the proportion of the output assets.
* `zap_deposit`: It executes a zap and a deposit in a single transaction.
* `withdraw`: Allows users to withdraw assets from the DeFindex.
* `zap_withdraw`: Allows users to withdraw assets from the DeFindex and receive a single asset. This function receives the amount of one asset and an array of Soroswap's Aggregator Swap transactions. This array is computed offchain using the best path and the proportion of the output assets.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.defindex.io/advanced-documentation/10-whitepaper/04-contracts/02-zapper-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
