> For the complete documentation index, see [llms.txt](https://openindex.gitbook.io/openindex/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openindex.gitbook.io/openindex/open-index-protocol-architecture.md).

# Open Index Protocol Architecture

## Sections

1. [Overview](#id-1.-overview)
2. #### [<sup>Core Protocol</sup>](#id-2.-phase-1-architecture-core-protocol)
3. #### [<sup>Modules</sup>](#id-3.-modules-coming-soon)
4. #### [<sup>Design Principles</sup>](#id-4-design-principles)
5. #### [<sup>Code Repository</sup>](#id-6.-code-repository)

## **1. Overview**

Open Index Protocol is a Solana-native index fund engine that allows users or DAOs to create tokenized indexes. Each index represents a basket of SPL tokens. Users can mint and redeem index tokens based on the composition, and rebalancing logic is modularized for future extensions.

The protocol follows an **SPL-style architecture**, with clearly separated state accounts and support for plug-in modules such as rebalancers, swap executors and DeFI strategies . This design enables strategy-specific customization while remaining secure and composable.

***

## 2. Core Protocol

#### Features Implemented

* <mark style="color:red;">`InitProtocol`</mark>: Initializes global protocol config
* <mark style="color:red;">`InitController`</mark>: Sets up authority that can create indexes. Has a one to many relationship with protocol config
* <mark style="color:red;">`CreateIndex`</mark>: Creates an index tied to a controller
* <mark style="color:red;">`AddIndexComponents`</mark>: Adds SPL token components and weights
* <mark style="color:red;">`Mint`</mark> <mark style="color:red;"></mark><mark style="color:red;">/</mark> <mark style="color:red;"></mark><mark style="color:red;">`Redeem`</mark>: Mints and burns index tokens using underlying tokens
* <mark style="color:red;">`InitModule`</mark>: Registers external programs for advanced features eg Rebalancing, Amm Swap, DEFI Strategies

### 2.1. Key Accounts

<table><thead><tr><th>PDA Account</th><th>PDA Seed(s)</th><th width="224.58203125">Purpose</th></tr></thead><tbody><tr><td>Protocol</td><td>["open_index"]</td><td>Global protocol settings, initialization guard</td></tr><tr><td>ControllerGlobalConfig</td><td>["open_index_controller_global"]</td><td>Stores authority and global controller settings</td></tr><tr><td>Controller</td><td>["open_index_controller", controller_id]</td><td>Stores settings for the controller and its indexes</td></tr><tr><td>Index</td><td>["open_index_index", controller_key, index_id]</td><td>Main state object representing an index</td></tr><tr><td>Component</td><td>["open_index_component", index_id, mint]</td><td>Represents each token component in the index</td></tr><tr><td>IndexMints</td><td>["open_index_mints_data", controller_id, index_id]</td><td>Tracks index mints and associated metadata</td></tr><tr><td>Module</td><td>["open_index_module", module_signer]</td><td>Holds registration &#x26; status (active/paused) for a plug-in program allowed to CPI into the core open index protocol</td></tr></tbody></table>

***

### 2.2 Roles & Access

| Role             | Permissions                                                                                                                                                                          |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Protocol Admin   | Initialize protocol and global configs                                                                                                                                               |
| Controller Owner | A controller is an administrative domain that can own multiple indexes and has its own configuration and governance. Create indexes, assign index managers , manage index components |
| User             | Mint/redeem index tokens                                                                                                                                                             |
| Future DAO       | Replace controller owner, vote on rebalance triggers                                                                                                                                 |

### [2.3 Instructions & Flow](#id-2.3-instructions-and-flow)

A high-level view of user interactions with the protocol instructions and resulting accounts

<figure><img src="/files/EcAkqOqPQooIpdHQpOMa" alt=""><figcaption></figcaption></figure>

*Figure 1 – High level view of Open Index protocol instructions implemented in Phase 1*

#### 1 <mark style="color:red;">`init_protocol`</mark>

* Initializes the top-level protocol state
* Called once by the deployer or initializer

#### 2 <mark style="color:red;">`init_controller`</mark>

* Creates a controller for a specific index set - A controller is an administrative domain that can own multiple indexes and has its own configuration and governance.
* Tied to an index ID

#### 3 <mark style="color:red;">`init_controller_global_config`</mark>

* Sets up controller-wide configuration (authority, parameters)

#### 4 <mark style="color:red;">`create_index`</mark>

* Creates a new index
* Defines its component tokens and initial composition

#### 5 <mark style="color:red;">`add_index_components`</mark>

* Adds  component tokens under an index created at step 4

#### 6 <mark style="color:red;">`mint`</mark>

* Mints index tokens by depositing the proportional component tokens into their vaults

#### 7<mark style="color:red;">`redeem`</mark>

* Burns index tokens and returns proportional amounts of underlying component tokens

#### 8 [<mark style="color:red;">`init_module`</mark>](#id-8-init_module)

* Registers an external module / program (like the Trade Module) to be used by the protocol or a specific index

#### <mark style="color:red;">`rebalance`</mark> *<mark style="color:red;">(planned)</mark>*

* To be called  (by authority or DAO) to adjust vaults based on price drift and unit ratio
* Relies on the Trade Module to execute token swaps via CPI to DEX routers

***

## **3. Modules (Coming Soon)**

Open Index Protocol's extensibility is achieved through Solana programs (modules) registered via the core protocol's [`init_module`](#id-8-init_module) instruction. This instruction (implemented in the main `open_index` program) authorizes external modules to perform CPI calls into protocol functions while enforcing PDAs and authority checks.

### 3.1 Issuance Module

1. **Pre-Issuance Hooks**
   * **Whitelist Verification:** Supports address allowlists ( could also include NFT ownership checks, or DAO vote verification)
   * **Fee Pre-Calculation:** Computes protocol/manager fees before minting
   * **Custom Business Logic:** Developers can register additional pre-issuance checks
2. **Post-Redemption Hooks**

   * Execute after tokens are redeemed but before assets are released

   <figure><img src="/files/gb7N9wT29Ci7z92ScMtM" alt=""><figcaption><p>Figure 2: Issuance module registration &#x26; hooks registration</p></figcaption></figure>

<figure><img src="/files/UphHqICTZH4KmGjHQWbA" alt=""><figcaption><p>Figure 3: Mint / Redeem execution flow with hooks interceptions</p></figcaption></figure>

### 3.2 Rebalance  Architecture - Rebalance & Trade Modules

This section explains how  rebalancing is achieved using two stand-alone programs (rebalancer module & Trade Module) that plug into the core Open Index protocol via CPI calls after they have been registered using the `init_module` instruction *(`see instruction 8 in figure 1`)* and authorized to invoke the index.

<figure><img src="/files/U3VPaVSAb6FAlq6Slq8Q" alt=""><figcaption><p>Figure 4: Rebalancing Architecuture</p></figcaption></figure>

#### 3.2.1 Rebalance Module

Deployed *per-index* or *shared* across indexes (configurable)

* A separate on-chain program registered via `init_module` on the core protocol
* Reads vault balances and oracle prices
* Computes rebalance plan (which tokens to sell/buy)
* **Does not perform swaps directly**
* Triggers Trade Module via CPI to execute

#### 3.2.2 Trade Module

* Also registered via `init_module`
* Handles DEX routing via a supported DEX e.g Raydium , Orca etc
* Executes swaps securely
* Deposits swapped tokens into index vaults

#### 3.2.3 Oracle Integration

Price feed addresses registered in `init_oracle_accounts` (future instruction)

* Pyth or Switchboard feeds
* Prices used to calculate USD value of each component
* Confidence interval and freshness checks enforced

***

### 3.3 Governance Architecture

Open Index Protocol supports **multi-tier governance**, where both the protocol and controllers can define their own rules and constraints.

#### 3.3.1 Protocol-Level Governance

```
  Managed by a global DAO, multisig, or protocol council.
```

**Responsibilities:**

* Initialize the protocol
* Whitelist or restrict modules via `init_module`
* Approve upgrades or feature flags
* Set global rate limits or constraints (optional)

```rust
pub struct ProtocolGovernanceConfig {
  pub global_paused: bool,
  pub allowed_modules: Vec<Pubkey>, // Could be accounts for registered modules
  pub protocol_admin: Pubkey,
}
```

#### 3.3.2 Controller-Level Governance

Managed by the controller owner (a wallet, multisig, or DAO).

**Responsibilities:**

* Manage index creation, component updates, rebalancing
* Set controller-level access policies
* Pause or resume minting/redeeming
* Define rebalancing logic and authorities

```rust
pub struct ControllerGovernanceConfig {
  pub paused: bool,
  pub rebalance_authority: Pubkey,
  pub mint_authority: Pubkey,
  pub max_components: u32,
  pub rebalance_interval: u64,
}
```

***

This config is stored directly in the `Controller` account. Each instruction (e.g. `mint`, `redeem`, `rebalance`) checks this configuration before proceeding.

***

## 4 Design Principles

### **4.1 Modular:**

* Programs can be added, upgraded, or replaced via `init_module`

### **4.2 Composable:**

* Supports DAO plug-ins and custom strategies

### **4.3 Secure:**

* Vaults and critical instructions protected by PDA validation and authority checks

### **4.4 Public Good:**

* All logic open-source and designed for DAO use

***

## 5. Code Repository

* Github <https://github.com/OpenIndexProtocol/openindexprotocol>
* License: MIT / Apache-2.0

***
