# enzymefinance/protocol-onyx architecture

> Architecture diagram of the GitHub repository enzymefinance/protocol-onyx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/enzymefinance/protocol-onyx
- Repository: https://github.com/enzymefinance/protocol-onyx

## Overview

1. **What this repository is**
   - Onyx is an EVM smart-contract system for tokenizing on-chain and off-chain value.
   - The architecture is organized as a modular protocol rather than a single monolith: most business logic lives under `src/components`, with supporting infrastructure, factories, interfaces, and tests around it.

2. **Core protocol shape**
   - The codebase is split into domain components such as **issuance**, **fees**, **value**, **lists**, **roles**, **shares-transfer validation**, and **automations**.
   - This suggests a layered design where a central tokenized-asset protocol composes multiple policy modules instead of embedding all behavior into one contract.

3. **Issuance subsystem**
   - `src/components/issuance` contains the mint/redeem lifecycle, with separate `deposit-handlers` and `redeem-handlers`.
   - This is likely the main user-facing state transition path: assets enter through deposit handlers, shares are minted, and later shares are redeemed through redeem handlers.

4. **Fee subsystem**
   - `src/components/fees` is split into management-fee and performance-fee trackers plus utility code and interfaces.
   - The presence of trackers implies fees are accrued via accounting modules that observe positions/value over time, rather than being a simple per-transfer deduction.
   - `interfaces/` under fees indicates fee logic is pluggable or standardized across contracts.

5. **Value and portfolio accounting**
   - `src/components/value` and `src/components/value/position-trackers` appear to handle valuation and position state.
   - This is the accounting layer that other subsystems depend on: issuance and fees likely consume value/position data to determine share pricing, performance, or eligibility.

6. **Shares and transfer controls**
   - `src/shares` and `src/components/shares-transfer-validators` indicate a dedicated share-token layer with transfer restrictions.
   - The transfer validator boundary is important for compliance-style rules: share moves are not just ERC-20 transfers, but are mediated by policy contracts.

7. **Lists, roles, and governance-like controls**
   - `src/components/lists`, `src/infra/lists`, and `src/components/roles` suggest configurable allowlists/denylists and role-based permissions.
   - `src/infra/lists/address-list` looks like a lower-level list primitive used by higher-level policy modules.
   - These controls likely gate issuance, redemption, transfers, and automation actions.

8. **Automation and oracle integration**
   - `src/components/automations/chainlink-cre` suggests integration with Chainlink CRE for automated triggers or off-chain workflow execution.
   - `src/infra/oracles` indicates a separate infrastructure layer for price or value inputs used by accounting or issuance logic.
   - These integrations are external-data boundaries: they feed state or triggers into the protocol but are separated from core accounting.

9. **Factories and deployable composition**
   - `src/factories` implies contracts are deployed through factory patterns, likely to instantiate configurable components or protocol instances.
   - This fits the repo’s modular design: core logic is assembled into deployable systems rather than hard-coded as one fixed instance.

10. **Shared utilities and global layer**
   - `src/global` and `src/global/utils` appear to provide cross-cutting helpers, constants, or shared abstract behavior.
   - `src/components/utils` and `src/utils` likely contain reusable internal helpers that are not domain-specific.
   - These layers reduce duplication across issuance, fees, lists, and other modules.

11. **Interfaces and boundary definition**
   - `src/interfaces` and `src/interfaces/external` define the protocol’s public and third-party integration surfaces.
   - This is the main contract boundary layer for architecture diagrams: internal modules call each other through these interfaces, and external integrations are isolated here.

12. **Testing and verification**
   - `test/` contains harnesses, mocks, interfaces, and utilities, showing the repo is structured for unit/integration-style contract testing.
   - The presence of `slither.config.json`, `slither.db.json`, and audit artifacts under `audits/` indicates security review is a first-class concern.

13. **Tooling and runtime**
   - The repository is built for Foundry (`foundry.toml`, `forge build`, `forge test`) and uses vendored OpenZeppelin upgradeable contracts.
   - That implies the runtime is Solidity/EVM, with upgradeable-contract patterns likely influencing how components are composed and initialized.

14. **High-level data flow**
   - Typical flow appears to be: external actor interacts with issuance or share-transfer entrypoints → permission/list/validator checks run → value/oracle/position data is consulted → shares or assets are minted, redeemed, or transferred → fee trackers update accounting state → automation/oracle hooks may react to events or thresholds.
   - For an architecture diagram, the main boundaries are: **protocol entrypoints**, **policy/permission modules**, **accounting/value modules**, and **external integration adapters**.

15. **Operational and project structure**
   - CI is enforced via GitHub Actions in `.github/workflows`, and the repo includes security-related documentation and audit records.
   - Licensing is source-available BUSL-1.1 for first-party code, with vendored dependencies retaining their original licenses.

Main entry points: [`src/components/issuance`](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance) (Issuance), [`src/components/shares-transfer-validators`](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/shares-transfer-validators) (Transfer guards), [`src/components/fees`](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees) (Fees), [`src/components/value`](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/value) (Value)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core protocol"]
  node_src_components_issuance["Issuance<br/>protocol module"]
  node_src_components_issuance_deposit_handlers["Deposit hooks<br/>issuance flow"]
  node_src_components_issuance_redeem_handlers["Redeem hooks<br/>issuance flow"]
  node_src_components_fees["Fees<br/>accounting module"]
  node_src_components_fees_management_fee_trackers["Mgmt trackers<br/>fee accounting"]
  node_src_components_fees_performance_fee_trackers["Perf trackers<br/>fee accounting"]
  node_src_components_value["Value<br/>valuation module"]
  node_src_components_value_position_trackers["Position trackers<br/>valuation state"]
  node_src_components_shares_transfer_validators["Transfer guards<br/>policy module"]
  node_src_components_lists["Lists<br/>policy module"]
  node_src_components_roles["Roles<br/>access control"]
  node_src_components_automations_chainlink_cre["Chainlink CRE<br/>automation adapter"]
end

subgraph group_support["Support layer"]
  node_src_shares["Shares<br/>token layer"]
  node_src_factories["Factories<br/>deployment module"]
  node_src_interfaces["Interfaces<br/>contract boundary"]
  node_src_interfaces_external["External APIs<br/>integration boundary"]
  node_src_infra_oracles["Oracles<br/>data adapter"]
  node_src_infra_lists_address_list["Address list<br/>infra primitive"]
  node_src_components_utils["Comp utils<br/>shared helpers"]
  node_src_global["Global<br/>shared base"]
  node_src_global_utils["Global utils<br/>shared helpers"]
end

subgraph group_verify["Verification"]
  node_test["Tests<br/>verification suite"]
  node_audits["Audits<br/>security review"]
end

node_src_components_issuance -->|"uses"| node_src_components_issuance_deposit_handlers
node_src_components_issuance -->|"uses"| node_src_components_issuance_redeem_handlers
node_src_components_issuance -->|"prices with"| node_src_components_value
node_src_components_issuance -->|"gates by"| node_src_components_lists
node_src_components_issuance -->|"requires"| node_src_components_roles
node_src_components_issuance -->|"accrues"| node_src_components_fees
node_src_components_fees -->|"tracks"| node_src_components_fees_management_fee_trackers
node_src_components_fees -->|"tracks"| node_src_components_fees_performance_fee_trackers
node_src_components_fees -->|"reads"| node_src_components_value
node_src_components_value -->|"maintains"| node_src_components_value_position_trackers
node_src_components_value -->|"consumes"| node_src_infra_oracles
node_src_components_shares_transfer_validators -->|"guards"| node_src_shares
node_src_components_shares_transfer_validators -->|"checks"| node_src_components_lists
node_src_components_shares_transfer_validators -->|"checks"| node_src_components_roles
node_src_components_shares_transfer_validators -->|"consults"| node_src_components_value
node_src_components_lists -->|"built on"| node_src_infra_lists_address_list
node_src_components_automations_chainlink_cre -->|"reacts to"| node_src_infra_oracles
node_src_factories -->|"deploys"| node_src_components_issuance
node_src_factories -->|"deploys"| node_src_components_fees
node_src_factories -->|"deploys"| node_src_components_shares_transfer_validators
node_src_interfaces -->|"defines"| node_src_components_issuance
node_src_interfaces -->|"defines"| node_src_components_fees
node_src_interfaces -->|"defines"| node_src_components_shares_transfer_validators
node_src_interfaces_external -->|"adapts"| node_src_infra_oracles
node_src_components_utils -->|"supports"| node_src_components_issuance
node_src_components_utils -->|"supports"| node_src_components_fees
node_src_global -->|"contains"| node_src_global_utils
node_test -->|"verifies"| node_src_interfaces
node_test -->|"verifies"| node_src_components_issuance
node_audits -->|"reviews"| node_src_components_shares_transfer_validators

click node_src_components_issuance "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance"
click node_src_components_issuance_deposit_handlers "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance/deposit-handlers"
click node_src_components_issuance_redeem_handlers "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance/redeem-handlers"
click node_src_components_fees "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees"
click node_src_components_fees_management_fee_trackers "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees/management-fee-trackers"
click node_src_components_fees_performance_fee_trackers "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees/performance-fee-trackers"
click node_src_components_value "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/value"
click node_src_components_value_position_trackers "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/value/position-trackers"
click node_src_components_shares_transfer_validators "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/shares-transfer-validators"
click node_src_components_lists "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/lists"
click node_src_components_roles "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/roles"
click node_src_components_automations_chainlink_cre "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/automations/chainlink-cre"
click node_src_shares "https://github.com/enzymefinance/protocol-onyx/tree/main/src/shares"
click node_src_factories "https://github.com/enzymefinance/protocol-onyx/tree/main/src/factories"
click node_src_interfaces "https://github.com/enzymefinance/protocol-onyx/tree/main/src/interfaces"
click node_src_interfaces_external "https://github.com/enzymefinance/protocol-onyx/tree/main/src/interfaces/external"
click node_src_infra_oracles "https://github.com/enzymefinance/protocol-onyx/tree/main/src/infra/oracles"
click node_src_infra_lists_address_list "https://github.com/enzymefinance/protocol-onyx/tree/main/src/infra/lists/address-list"
click node_src_components_utils "https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/utils"
click node_src_global "https://github.com/enzymefinance/protocol-onyx/tree/main/src/global"
click node_src_global_utils "https://github.com/enzymefinance/protocol-onyx/tree/main/src/global/utils"
click node_test "https://github.com/enzymefinance/protocol-onyx/tree/main/test"
click node_audits "https://github.com/enzymefinance/protocol-onyx/tree/main/audits"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_src_components_issuance,node_src_components_issuance_deposit_handlers,node_src_components_issuance_redeem_handlers,node_src_components_fees,node_src_components_fees_management_fee_trackers,node_src_components_fees_performance_fee_trackers,node_src_components_value,node_src_components_value_position_trackers,node_src_components_shares_transfer_validators,node_src_components_lists,node_src_components_roles,node_src_components_automations_chainlink_cre toneBlue
class node_src_shares,node_src_factories,node_src_interfaces,node_src_interfaces_external,node_src_infra_oracles,node_src_infra_lists_address_list,node_src_components_utils,node_src_global,node_src_global_utils toneAmber
class node_test,node_audits toneMint
```

## Components

### Core protocol

Primary tokenized-asset logic and policy modules.

- [Issuance](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance): protocol module · Mint and redeem lifecycle for tokenized value. · `src/components/issuance`
- [Deposit hooks](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance/deposit-handlers): issuance flow · Deposit-side handlers that drive mint entrypoints. · `src/components/issuance/deposit-handlers`
- [Redeem hooks](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance/redeem-handlers): issuance flow · Redeem-side handlers that drive exit entrypoints. · `src/components/issuance/redeem-handlers`
- [Fees](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees): accounting module · Management and performance fee accounting. · `src/components/fees`
- [Mgmt trackers](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees/management-fee-trackers): fee accounting · Tracks management-fee accrual over time. · `src/components/fees/management-fee-trackers`
- [Perf trackers](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/fees/performance-fee-trackers): fee accounting · Tracks performance-fee accrual from value changes. · `src/components/fees/performance-fee-trackers`
- [Value](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/value): valuation module · Portfolio and pricing inputs used across the protocol. · `src/components/value`
- [Position trackers](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/value/position-trackers): valuation state · Maintains position-level accounting state. · `src/components/value/position-trackers`
- [Transfer guards](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/shares-transfer-validators): policy module · Validates share transfers against protocol rules. · `src/components/shares-transfer-validators`
- [Lists](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/lists): policy module · Allowlist and denylist style controls. · `src/components/lists`
- [Roles](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/roles): access control · Role-based permissions for privileged actions. · `src/components/roles`
- [Chainlink CRE](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/automations/chainlink-cre): automation adapter · Automation trigger integration for off-chain or scheduled workflows. · `src/components/automations/chainlink-cre`

### Support layer

Shared infrastructure, adapters, factories, and interfaces.

- [Shares](https://github.com/enzymefinance/protocol-onyx/tree/main/src/shares): token layer · Share token and transfer surface for the protocol. · `src/shares`
- [Factories](https://github.com/enzymefinance/protocol-onyx/tree/main/src/factories): deployment module · Deploys configurable protocol instances and components. · `src/factories`
- [Interfaces](https://github.com/enzymefinance/protocol-onyx/tree/main/src/interfaces): contract boundary · Internal protocol interfaces and shared contract definitions. · `src/interfaces`
- [External APIs](https://github.com/enzymefinance/protocol-onyx/tree/main/src/interfaces/external): integration boundary · Third-party and externally consumed interfaces. · `src/interfaces/external`
- [Oracles](https://github.com/enzymefinance/protocol-onyx/tree/main/src/infra/oracles): data adapter · External pricing and value feeds used by accounting and issuance. · `src/infra/oracles`
- [Address list](https://github.com/enzymefinance/protocol-onyx/tree/main/src/infra/lists/address-list): infra primitive · Low-level list primitive used by higher-level policy modules. · `src/infra/lists/address-list`
- [Comp utils](https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/utils): shared helpers · Reusable helpers shared across protocol components. · `src/components/utils`
- [Global](https://github.com/enzymefinance/protocol-onyx/tree/main/src/global): shared base · Cross-cutting constants and shared abstractions. · `src/global`
- [Global utils](https://github.com/enzymefinance/protocol-onyx/tree/main/src/global/utils): shared helpers · Common utilities shared across the codebase. · `src/global/utils`

### Verification

Tests and audit artifacts.

- [Tests](https://github.com/enzymefinance/protocol-onyx/tree/main/test): verification suite · Harnesses, mocks, and contract tests. · `test`
- [Audits](https://github.com/enzymefinance/protocol-onyx/tree/main/audits): security review · Audit reports and QA findings. · `audits`

## Connections

- Issuance → Deposit hooks: uses · Deposit handlers implement mint entrypoints.
- Issuance → Redeem hooks: uses · Redeem handlers implement exit entrypoints.
- Issuance → Value: prices with · Issuance consults valuation for share pricing.
- Issuance → Lists: gates by · Entry and exit paths can be restricted by list policy.
- Issuance → Roles: requires · Privileged issuance actions depend on roles.
- Issuance → Fees: accrues · Mint and redeem flows update fee accounting.
- Fees → Mgmt trackers: tracks · Management fees are accumulated by dedicated trackers.
- Fees → Perf trackers: tracks · Performance fees are accumulated by dedicated trackers.
- Fees → Value: reads · Fee logic depends on portfolio value and performance.
- Value → Position trackers: maintains · Valuation uses position-level accounting state.
- Value → Oracles: consumes · External price feeds inform valuation.
- Transfer guards → Shares: guards · Transfers are mediated through share-token boundaries.
- Transfer guards → Lists: checks · Transfer policy can reference allow/deny lists.
- Transfer guards → Roles: checks · Role constraints can affect transfer permissioning.
- Transfer guards → Value: consults · Validation may depend on account or portfolio state.
- Lists → Address list: built on · Higher-level list policy uses address-list primitives.
- Chainlink CRE → Oracles: reacts to · Automation is driven by external data or conditions.
- Factories → Issuance: deploys · Factories assemble issuance-capable protocol instances.
- Factories → Fees: deploys · Factories wire fee modules into deployments.
- Factories → Transfer guards: deploys · Factories configure transfer policy modules.
- Interfaces → Issuance: defines · Interfaces describe protocol contracts and boundaries.
- Interfaces → Fees: defines · Interfaces describe fee-module contracts.
- Interfaces → Transfer guards: defines · Interfaces describe transfer-validator boundaries.
- External APIs → Oracles: adapts · External integration surfaces include oracle-style contracts.
- Comp utils → Issuance: supports · Shared helpers reduce duplication in core modules.
- Comp utils → Fees: supports · Shared helpers reduce duplication in fee modules.
- Global → Global utils: contains · Global layer provides reusable utility functions.
- Tests → Interfaces: verifies · Tests exercise the public contract surfaces.
- Tests → Issuance: verifies · Tests cover mint and redeem flows.
- Audits → Transfer guards: reviews · Audit artifacts focus on policy and validator behavior.
