# Vault Documentation

### Purpose and overview

Vaults are smart contracts with share accounting that can call the settlement contract by a permissioned executor. The purpose of the vault contract is to crowdsource liquidity for setting bid/ask spreads for a given token pair. The vault contract calls the settlement contract, where orders are encoded and placed, while maintaining its own storage for share accounting, airdrop accounting and business logic for keeping the vault inventories roughly 50/50 balanced.

Vaults have two tokens associated - base and quote. Hedera contracts must be associated with tokens to custody them, and can be transferred to and from accounts and contracts without an EVM contract call.

### Inventory balancing

The vault contract seeks to keep its inventory values distributed 50/50. For example, for a HBAR/USDC vault, if the current fair market price as determined by the Supra oracle is HBAR = 0.2 USDC, the vault will seek 5x as much HBAR in its inventory as USDC. Rebalancing is achieved through deposits and withdrawals of the underweight and overweight tokens, respectively. Deposits are only allowed in the underweight token until a 50/50 mix of inventories is achieved, and 50/50 token mixes are deposited thereafter. Below is an example of how it works if 1 HBAR is trading for 1 USDC:

<figure><img src="/files/twEPmQ3uG4IPwdU0FVFe" alt=""><figcaption></figcaption></figure>

Likewise, withdrawals are paid in the overweight token, then 50/50 value mix when the vault is in a balanced state.

### Airdrop campaigns

Airdrops are awarded to vaults in proportion to how close to the Lambdaplex order book midprice they spread liquidity. Vault operators face the challenge of balancing earning airdrops for depositors with the risk of losing inventory value through tighter spreads. Airdrop campaigns for reward tokens last one week and are awarded via AirdropDistributor.&#x20;

The pattern for funding and collecting airdrops is&#x20;

1. Fund AirdropDistributor with one week of reward token per vault. Vaults can accept multiple reward tokens. Contact <support@lambdaplex.io> to request including a new reward token to AirdropDistributor.
2. As users vest reward tokens, they may claim them in the vault. The vault contract calls AirdropDistributor to send the tokens to the user in proportion to their shares in the vault.
3. If more of the same reward tokens are deposited to AirdropDistributor during an active campaign, those new tokens are added to the current active campaign (not a new campaign per fund)
4. When the campaign is over, no more reward tokens are vested until a new campaign is initiated.

### Management fees

Vault owners are compensated for market making by withdrawing a small percentage of the vault’s reserves. This is accomplished similarly to UniswapV2 owner fees by awarding the vault owner shares of the vault and diluting the depositors’ shares. The vault owner is compensated through a percentage of vault inventories in order to keep incentives aligned with depositors.&#x20;

Vault owners are incentivized to not lose inventory with risky market making strategies, as their vault’s reserves would reduce as a result. However, if their bid/ask spreads are very wide from the midprice, they will not generate airdrops for users, and presumably users would move to vaults that provide better rewards. We believe compensating owners this way achieves a better incentives balance than allowing owners to take a share of the airdrops. The Lambdaplex UI displays the APR for the inventory and APR for airdrops, so depositors will have the information for risk and reward.

Management fee percentage may be changed, but the vault owner must wait one week for the new fee to become effective. This gives users enough time to decide whether they find the new fee acceptable.

### Placing trades

Market makers apply for an API key to place trades through a Binance style spot API. This key is used to act on behalf of the vault depositors. Trades rest on the Lambdaplex Order Service. When a trade is ready to be filled with another party, Lambdaplex Labs will reference the vault's signature bytes and/or stored order in the settlement contract to authorize the trade from the vault to the trade counterparties.


---

# 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://lambdaplex-labs.gitbook.io/lambdaplex/vaults/vault-documentation.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.
