# Guides

## Deployment of SIV

[Foundry Script](https://github.com/Y2K-Finance/SelfInsuredVault/blob/master/script/DeployScript.s.sol)

SIV constructor requires three addresses as input parameters: `paymentToken`, `yieldSource`, and `emissionsToken`. It's important to note that for Carousel, `emissionsToken` represents the Y2K token, while for V2 or V1, it should be `address(0)`.

```
    SelfInsuredVault siv = new SelfInsuredVault(
        paymentToken,
        yieldSource,
        emissionsToken
    );
```

Once you have deployed SIV, it is crucial to remember to transfer the ownership of the `yieldSource` to SIV.

```
    IYieldSource(yieldSource).transferOwnership(address(siv));
```

## Add markets to SIV

[Foundry Script](https://github.com/Y2K-Finance/SelfInsuredVault/blob/1fccdb77ea5c2e1c070a2372cf74f73feb15b046/script/Configure.s.sol#LL9C10-L9C20)

The market information consists of several key parameters: `insuranceProvider`, `marketId`, `premiumWeight`, and `collateralWeight`. \
For a detailed explanation of these parameters, please refer to the technical overview.\
Insurance Provider addresses can be found [here](/y2k-finance/products/earthquake-builder-program/builder-info/technical-overview-of-the-insuranceprovider-contract.md#insurance-provider).

```
    SelfInsuredVault(siv).addMarket(
        market.insuranceProvider,
        market.marketId,
        market.premiumWeight,
        market.collateralWeight
    );
```

Market weights can be updated with market index.

```
    SelfInsuredVault(siv).setWeight(
        index,
        newPremiumWeight,
        newCollateralWeight
    );
```

## Purchase Insurance

The `purchaseInsuranceForNextEpoch` function in SIV is designed to deposit funds into Earthquake. Notably, this function does not require any parameters to be provided.

```
    SelfInsuredVault(siv).purchaseInsuranceForNextEpoch();
```


---

# 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://y2k-finance.gitbook.io/y2k-finance/products/earthquake-builder-program/guides.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.
