# Omnipools

### Maximizing Yield through Decentralized Strategies

Zunami's ecosystem comprises three Omnipools, catering to USD-pegged, ETH-pegged and BTC-pegged stablecoins. Each Omnipool represents a collection of strategies, with the flexibility to accommodate an unlimited number of them. These strategies undergo rebalancing and differentiation based on DAO voting. Operating as a Yield Aggregator, Omnipools enhances liquidity by deploying funds across various strategies and distributed generated profits to ZUN stakers and Vote Markets.

<figure><img src="https://2215456193-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UwKdZHxlONT2oRfzlBn%2Fuploads%2FMvVd72FNa2jES0C19z8K%2FEthereum_version%20111.webp?alt=media&#x26;token=d95ecfc2-7e83-4d31-8def-8d2638edfb5f" alt=""><figcaption><p>Ethereum Version. Base Concept</p></figcaption></figure>

Zunami Omni pool enables deposit stablecoins, Regardless of which strategy the funds were allocated to, each depositor in Zunami will receive a zunStables proportional to their contribution to the protocol. These zunStables are minted atop Omnipools, and each zunStable is intrinsically backed by its corresponding Omnipool.

The community and Zunami's team diligently assess the risk profiles of stablecoin allocations. Through DAO voting, decisions are collectively made regarding strategies and asset rebalancing. This dynamic process ensures users enjoy optimal yields while diversifying their investments across trusted pools. Notably, Zunami operates as a fully decentralized protocol, with all activities within Omni pools governed through on-chain [DAO voting](https://snapshot.org/#/zunamidao.eth).

Profits generated by Omnipools are shared among [ZUN token stakers](https://zunamilab.gitbook.io/zunami-docs/governance-and-zun-token/zun-token#zun-staking) and Vote Markets. Moreover, these stakers bear financial responsibility in the event of [recapitalization](https://zunamilab.gitbook.io/zunami-docs/risks-and-security/collateral-recapitalization), thereby fostering maximum alignment of interests.

### Strategies&#x20;

In the dynamic DeFi landscape, achieving peak yields necessitates engagement with multiple protocols. Zunami simplifies this complex process by offering various strategies and automating these actions within a single transaction. Zunami's mechanism places stablecoins into a range of strategies, which which in turn puts them as LP into Curve pools, receives Curve LP, and then stakes them in Convex or StakeDAO reward contracts (Gauges).

<figure><img src="https://2215456193-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UwKdZHxlONT2oRfzlBn%2Fuploads%2F59hfUwavt9LQ34DUQTLL%2FzunUSD_Omni_pool.webp?alt=media&#x26;token=aaa9d769-726d-4543-960c-1bd8423a9d54" alt=""><figcaption><p>zunUSD Omni Pool</p></figcaption></figure>

<figure><img src="https://2215456193-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UwKdZHxlONT2oRfzlBn%2Fuploads%2Fh3sqBzWRimoquGbVeTNT%2FzunETH_Omni_pool.webp?alt=media&#x26;token=3decaaf2-f535-4537-b359-77ccfb3f6328" alt=""><figcaption><p>zunETH Omni Pool</p></figcaption></figure>

The addition of new strategies and the determination of their weight within Omni pools solely occur through DAO voting. In instances of reduced collateral for zunStables, a recapitalization  process is initiated to restore the necessary backing.

### Formulas

The are two types of pools exist on Convex. Pools with \[CRV, CVX] rewards and \[CRV, CVX, Additional rewards...].&#x20;

Let's define some variables that we need fo calculation:

$$
\text {Where } i \text { is pid of Convex reward pool} \\
lp\_i - \text {price of lp token} \\
ts\_i - \text {total supply} \\
r\_i - \text {reward rate} \\
atp\_i - \text {additional token price} \\
ar\_i - \text {additional reward rate} \\
curveAPR\_i - \text {base Curve APR} \\
periodFinish\_i - \text {date (timestamp) when reward for pool will be disabled}\\
\allowbreak\\
cvxCliffs = cvxTotalCliffs - \frac{cvxTotalSupply}{cvxReductionPerCliff}\\
\allowbreak\\
cvxRewardPrice = \frac{cvxPrice \* cvxCliffs}{cvxTotalCliffs}  \\
\allowbreak\\
$$

Also, we need a binary function for make a decision based on the current timestamp:

$$
f(z) = \begin{cases}
0 &\text{if } z < currentTimestamp \\
1 &\text{if } z > currentTimestamp
\end{cases}
$$

And some constants:

$$
\text {Seconds in ETH block is } \boldsymbol{15} \\
\text {Blocks per year in ETH is } \mathbf{2102400} \\
$$

### Pools APR calculation formula

Based on the following formula, we can calculate annual percentage rate (APR):

$$
APR\_i = curveAPR\_i + f(periodFinish\_i)\* \frac{15 \* 2102400 \* cvxRewardPrice \* r\_i}{ts\_i \* lp\_i} + \\
f(periodFinish\_i)\* \frac{15 \* 2102400 \* cvxPrice \* r\_i}{ts\_i \* lp\_i} +\sum\_{k=0}^{N} f(periodFinish\_k) \* \frac{15 \* 2102400 \* atp\_k \* ar\_k}{ts\_i \* lp\_i} = \\
\allowbreak \\
curveAPR\_i + f(periodFinish\_i)\* \frac{31536000*r\_i*(cvxRewardPrice + cvxPrice)}{TVL\_i} + \\
\sum\_{k=0}^{N} f(periodFinish\_k) \* \frac{31536000 \* atp\_k \* ar\_k}{TVL\_i} , \text {where k is pid of additional reward pool}  \\
\allowbreak \\

TVL\_i = \text {Total value locked in pool }
$$

In this formula we calculate the APR for CRV, CVX and APR for an additional reward pools. The final APR is the sum of them (If we are not in the time interval when the pool is disabled)

### APY for pools

APY (Annual Percentage Yield) can be found from APR:

$$
APY\_i = (1 + \frac{APR\_i}{n})^n-1 \text {, where } n \text { compounds period in year}
$$
