# Fund Registry

## Overview <a href="#overview" id="overview"></a>

The Fund Registry (<mark style="color:red;">`FundRegistry.sol`</mark>) is used to store fund information. It also allows for creating new funds. Like most registries, it makes use of the eternal storage pattern to store information, inheriting the base registry. The Fund Registry uses fund Ids to store their associated data.

## Fund

Funds are managed by a fund admin, and have an associated group of instruments that belong to them. Funds are created in the KAIO system by the KAIO Admin.

### Fund Creation

* **Function**: `addNewFund(bytes32 _senderRole, bytes32 _fundId)`
* **Purpose**: Creates a new Fund in the KAIO system.
* **Parameters**:
  * `bytes32 _senderRole`: Role of the sender.
  * `bytes32 _fundId`: Id of the fund to create.
* **Validation Checks**:
  * Checks the fund Id is not 0.
  * Ensures the caller has the proper role.
  * Makes sure the fund does not already exist.
* **Behavior**:
  * Creates the new fund.
  * Emits a `NewFundAdded` event, signaling the fund has been added.
* **Example**:

  ```solidity
  addNewFund(0xAdminRole, 0xFundId);
  ```


---

# 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://docs.kaio.xyz/how-kaio-works/smart-contracts/registries/fund-registry.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.
