> For the complete documentation index, see [llms.txt](https://sovavault.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sovavault.gitbook.io/docs/technical-resources/developers-zone.md).

# Developers Zone

### Overview

This section outlines how power users and developers can interact directly with the protocol - whether to integrate with DeFi apps, build analytics dashboards, or automate workflows.

***

## Smart Contract Architecture

Sova is composed of **modular smart contracts**, following industry standards like **ERC-4626**. Below are the core components and their roles:

| **Contract**   | **Purpose**                                                                |
| -------------- | -------------------------------------------------------------------------- |
| **Registry**   | Manages deployments and component registration (strategies, hooks, assets) |
| **Strategy**   | Controls portfolio logic and interfaces with off-chain execution           |
| **tRWA Token** | ERC-4626 vault token representing user shares                              |
| **Conduit**    | Handles secure transfer of assets between user and protocol                |
| **Reporter**   | Provides NAV updates and price data                                        |
| **Escrow**     | Holds deposits temporarily during gated mint or withdrawal windows         |
| **Hook**       | Enforces compliance checks before actions like deposit or withdraw         |

***

## Key Standards Used

* **ERC-4626**: Vault interface standard for yield-bearing tokens
* **Minimal Proxy Pattern (EIP-1167)**: Used for gas-efficient strategy deployments
* **Role-Based Access Control (RBAC)**: Prevents unauthorized actions across the protocol
* **Off-chain Oracle Integration**: Reporter contract posts NAV and price feeds

***

## Roles & Access Permissions

Sova uses **granular, role-based permissions** to gate critical protocol functions:

| **Role**               | **Permissioned Actions**                   |
| ---------------------- | ------------------------------------------ |
| **PROTOCOL\_ADMIN**    | Add/remove assets, hooks, strategies       |
| **STRATEGY\_ADMIN**    | Manage strategies and their configuration  |
| **STRATEGY\_OPERATOR** | Pull/push funds from the strategy contract |
| **RULES\_ADMIN**       | Manage hook system for compliance logic    |
| **KYC\_OPERATOR**      | Modify allow/deny lists for investors      |
| **PRICE\_UPDATER**     | Push NAV updates to vault tokens           |

> 🔧 **Role Management**
>
> All roles are administered via a **Role Manager contract**. Roles can be granted, revoked, or self-renounced.

***

## Interacting with the Protocol

For developers looking to integrate:

### Read NAV and Vault Data

```solidity
uint256 nav = ITVault(tokenAddress).convertToAssets(userShares);
```

### Deposit Flow

```solidity
IERC20(USDC).approve(tokenAddress, amount);
ITVault(tokenAddress).deposit(amount, msg.sender);
```

### Redeem Flow

```solidity
ITVault(tokenAddress).redeem(shares, receiver, owner);
```

### For GatedMintRWA Vaults

```solidity
bytes32 depositId = IGatedMint(tokenAddress).requestDeposit(amount, receiver);
// Wait for manager approval...
IGatedMint(tokenAddress).mintShares(receiver, amount);
```

> 📚 **Documentation Resources**
>
> See the **Sova ABI & Interface repo** at <https://github.com/SovaNetwork/fountfi> for up-to-date contract ABIs and structs.

***

## Compliance Hooks & Extensibility

**Hooks** enable compliance logic (e.g. KYC, AML, transfer restrictions) to be modular and upgradeable.

* **Hooks can be added/removed** per vault
* **Operation-specific** (e.g., deposit, withdraw, transfer)
* **Common hooks include** KycRulesHook, TransferBlockHook, and WithdrawalQueueHook

> 🛠️ **Custom Development**
>
> Developers can write their own hook contracts following the **IHook interface** and register them via governance.

***

## Integrating tRWA Tokens in DeFi

Because tRWA tokens follow the **ERC-4626 interface**, they can be integrated into:

* **Lending markets**
* **Structured products**
* **Tokenized asset managers**
* **Portfolio dashboards** (e.g. Zapper, DeBank)

> ⚠️ **Integration Considerations**
>
> Be aware that some tRWA tokens are **non-transferable** or gated by compliance hooks - integration should account for that.
