# Builder Info

## Architecture Diagram

<figure><img src="https://lh6.googleusercontent.com/IIq2cYGbdIJYVV6-Vxd7zX32xVJiSRVL0HSt-WYBB-9cpcVxL01tso7FM93ybwuZc4QDBlhbTu-MStAb7YpPh6EKUTJ_S19IkJxfqyP6Hz-6Zv-fBP7vwWOGIQFhR_b8brPt89FhsKXAixJAXugElO8" alt=""><figcaption></figcaption></figure>

The architecture can be visualized with the help of the diagram linked below: [Architecture Diagram](https://excalidraw.com/#json=u8R_UEjmhysAHNE01VZqk,sJp6jrr2yYcqI1zpa2iISQ)

[Source Code](https://github.com/Y2K-Finance/SelfInsuredVault)\
\
The architecture consists of three main components:

1. **SelfInsuredVault (SIV)**: The SIV functions as a depository for a variety of yield-bearing assets, leveraging their yield to purchase insurance. In the occurrence of an earthquake event, the ensuing payout are distributed back to the users.
2. **YieldSource**: This encapsulates the implementation of IYieldSource and other actual yield sources like farming shares and other yield-bearing assets.
3. **InsuranceProviders**: These contracts serve as bridges between the SIV and earthquake vaults, facilitating deposit and withdrawal into an earthquake epoch.

### Interacting with the Contracts

Interacting with the contracts requires understanding and familiarity with the structure and function of each contract. Before you proceed, we recommend **familiarizing yourself with our documentation on Vaults, Markets, and Epochs.**

Here's a step-by-step guide to using these contracts:

1. **Configuring Markets**: As an admin of the SIV, you can add multiple markets with custom weights. The weights help calculate the purchase amount for insurance.
2. **Depositing into the SIV**: To mint shares in the SIV, you must deposit yield-bearing assets into the vault. This deposit operation transfers the assets to the YieldSource contract.
3. **Purchasing Insurance**: The process is initiated by the admin. It involves claiming the yields from the Yield Source and depositing them into the next provided epoch.
4. **Claiming Earthquake Payout:** Once the epoch is resolved, the yields can be claimed by anyone and will be allocated to the users entering the vault before the epoch started.\
   \ <br>
