> For the complete documentation index, see [llms.txt](https://docs.predy.finance/predy-v5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.predy.finance/predy-v5/core-of-v3.0/vault-design.md).

# Vault Design

{% hint style="info" %}
Points:

* Oracle Free Perpetual Option Protocol
* The exchange of tokens relies on Uniswap
* Applicable to all token pairs in Uniswap
  {% endhint %}

$$\begin{align\*}  \[Predy\_{v3 Core}]\          OptionVault\_{value} &= Asset - Debt + Margin&\      &= f\_2(x\_a,y\_a,LPT\_{asset}) - f\_2(x\_d,y\_d,LPT\_{debt})&\     &= f\_2(x\_a,y\_a, f\_1(x,y)) - f\_2(x\_{d},y\_d,f\_1(x,y))&\    \&where, LPT\_{value} = f\_1{(x, y)} \ inherited \ from \  Uniswap  &\       \&Example: x = ETH, y = USDC, \sqrt{P} = \sqrt{\frac{y}{x}} &\      f\_2(x\_a,y\_a, f\_1(x,y)) &= (x\_a + L *\frac{\sqrt{P\_b} -  \sqrt{P\_{twap}}}{\sqrt{P\_{twap}}\sqrt{P\_b} }) \* P\_{twap} + y\_a + L*(\sqrt{P\_{twap}} - \sqrt{P\_b})&\    f\_2(x\_d,y\_d, f\_1(x,y)) &= (x\_d + L *\frac{\sqrt{P\_b} -  \sqrt{P\_{twap}}}{\sqrt{P\_{twap}}\sqrt{P\_b} }) \* P\_{twap} + y\_d + L*(\sqrt{P\_{twap}} - \sqrt{P\_b})&\    \&where, L = \sqrt{xy}, P\_a =1.0001^{lowerTick} , P\_b=1.0001^{upperTick} , P\_a < P < P\_b &\      \end{align\*}$$​

Smart contracts manage $$OptionVault$$ by performing three main operations.

* Exchange of $$x$$ and $$y$$
* $$Asset$$ Management
* $$Debt$$ Management

$$OptionVault$$ has $$Margin$$ to pay/earn Premium with the $$Asset/Debt$$ management as follows:

* Mint and Burn of $$LPT$$, Lending and borrowing of $$LPT$$
* Deposits and withdrawals of $$x$$ or $$y$$​
* Lending and borrowing of $$x$$ or $$y$$

Predy v3 defines $$Safe$$ as follows, allowing Option positions to be taken in the Vault.

$$
\begin{align\*}  \[Safe\_{Predy\_{v3}}]\\

OptionVault\_{value} &= f\_2(x\_a,y\_a,LPT\_{asset}) - f\_2(x\_d,y\_d,LPT\_{debt}) + Margin &\\\
& > Min.Deposit (> 0)&\\

\end{align\*}
$$

Note:&#x20;

* In smart contracts, each option is corresponding to a SubVault.&#x20;
* Daily Premium payments are made in Margin and are not compounded.
