# Architecture

Pike's modular architecture is designed to:

* Balance risk isolation and capital efficiency, ensuring optimized liquidity management.
* Seamlessly integrate with future blockchain innovations, enabling adaptability and long-term scalability.
* Support factory-based deployments and multi-tier governance, allowing for customizable and autonomous market management.

The following diagram illustrates the smart contract architecture of Pike, showcasing the key components and their interactions within the system.

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

### **Factory**

The **Factory** contract serves as the central entry point for deploying new Pike Market instances and managing market creation. It ensures a structured deployment process while maintaining a registry of deployed contracts.

**Key Functions**

* **Protocol Deployment:** The Factory acts as a single entry point for deploying new protocols.
* **Market Deployment:** Authorized **governors** can deploy new markets through the Factory.
* **Registry Management:** The Factory maintains a record of all deployed protocol instances and markets for easy reference and governance.

### **Router Proxy**

The **Router Proxy** is a static diamond proxy that enables modular, upgradeable contracts by directing function calls to specific implementation modules. It maintains a single storage layout, ensuring consistency across contract upgrades.

**Key Functions**

* **Upgradeability:** Pike leverages the Router Proxy to enable seamless contract upgrades.
* **Modular Architecture:** Calls are routed to individual modules without affecting global storage.
* **Applications:** The Router Proxy is applied to key components such as the Risk Engine and pTokens, allowing them to be updated without redeploying the entire protocol.

### **Oracle Engine**

The Oracle Engine is a core infrastructure component of Pike that manages price data configuration and retrieval for pTokens. It acts as a unified interface that routes price requests to appropriate oracle providers while supporting multiple oracle implementations and fallback mechanisms for enhanced reliability.

**Key Features**

* **Multi-Oracle Support**: Compatible with Chainlink, Pyth
* **Fallback Mechanism**: Configurable secondary oracle with price validation
* **Governance Control**: Protocol governor manages all oracle configurations
* **Price Validation**: Automatic bounds checking between main and fallback oracles

### **Governance**

Pike implements a robust governance framework using an extended OpenZeppelin Timelock contract that enforces time delays for all protocol configuration changes. The system features multiple execution paths: the **Governor** proposes routine changes through the standard time-delayed process, the **Emergency Executor** can bypass delays for critical Timelock-managed functions, and the **Emergency Guardian** operates independently with direct access to emergency protocol functions like pausing and reserve withdrawals. This multi-layered approach ensures democratic oversight for routine changes while maintaining rapid response capabilities for emergencies, with all configuration functions—including oracle settings, risk parameters, and market caps—flowing through appropriate governance channels.

**Key Features:**

* **Time-Delayed Governance**: Enforced delays provide community review periods for protocol changes
* **Emergency Bypass**: Critical actions can be executed immediately when necessary
* **Democratic Execution**: Anyone can execute approved proposals after the delay period
* **Role Separation**: Different entities handle routine governance vs. emergency responses

For more details, please refer to the Governance section.


---

# 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.pike.finance/developer-docs/overview/readme.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.
