# yieldnest/yieldnest-kernel-lrt architecture

> Architecture diagram of the GitHub repository yieldnest/yieldnest-kernel-lrt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yieldnest/yieldnest-kernel-lrt
- Repository: https://github.com/yieldnest/yieldnest-kernel-lrt

## Overview

##### Main Components

a) Smart Contract Architecture Layer:
- Kernel Integration Components
- Yieldnest Vault System
- LRT Token Contracts
- External Protocol Interfaces (Solv, Synclub)

b) Module System:
- Core Modules (from /src/module)
- Utility Components (from /src/utils)

c) Network Layer:
- BNB Chain (BSC) Support (indicated by -56.json deployments)
- BSC Testnet Support (indicated by -97.json deployments)

**┌─────────────────────────────────────────────┐**
- Yieldnest Kernel LRT             │
- ┘

- ┌───────────┴───────────┐
- ▼                       ▼
**┌───────────────┐      ┌───────────────┐**
- Kernel Protocol│      │ Yieldnest Vault│
- ┘      └───────────────┘

- ┬──────────┘
- ▼
- ┌─────────────────┐
- Module System  │
- ┘

- ┌───────────┴───────────┐
- ▼                       ▼
**┌─────────┐           ┌─────────┐**
- External │           │ Utils   │
- Interfaces│           │         │
- ┘           └─────────┘

##### Detailed Component Breakdown

a) Smart Contract Interactions:
- Relationship between different token implementations (ynBTC, ynWBNB, ynClisBNB)
- Deployment configurations
- Interaction flows with external protocols

b) Module System:
- Detail the relationship between different modules
- How modules interact with the core vault system
- Utility functions and their scope

##### Important Elements to Highlight

- Token Flow Mechanics
- Staking/Unstaking Paths
- Yield Distribution Mechanisms
- Security Boundaries
- External Protocol Integration Points

##### Implementation Notes

- Clear hierarchical structure
- Proper component isolation
- Detailed interaction flows
- Network-specific considerations
- Testing and deployment paths

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Yieldnest Kernel LRT System"
        YieldnestKernel["Yieldnest Kernel LRT"]:::main
    end

    subgraph "Protocol Layer"
        KernelProtocol["Kernel Protocol"]:::protocol
        YieldnestVault["Yieldnest Vault System"]:::protocol
    end

    subgraph "Token Implementation Layer"
        ynBTC["ynBTC Token"]:::token
        ynWBNB["ynWBNB Token"]:::token
        ynClisBNB["ynClisBNB Token"]:::token
    end

    subgraph "Module System"
        ModuleSystem["Core Modules"]:::module
        Utils["Utility Components"]:::utils
    end

    subgraph "External Interfaces"
        SolvProtocol["Solv Protocol"]:::external
        SynclubProtocol["Synclub Protocol"]:::external
    end

    subgraph "Network Layer"
        BSCMainnet["BSC Mainnet"]:::network
        BSCTestnet["BSC Testnet"]:::network
    end

    subgraph "Testing & Deployment"
        UnitTests["Unit Tests"]:::testing
        MainnetTests["Mainnet Tests"]:::testing
        DeployScripts["Deployment Scripts"]:::deployment
    end

    YieldnestKernel --> KernelProtocol
    YieldnestKernel --> YieldnestVault

    KernelProtocol --> ModuleSystem
    YieldnestVault --> ModuleSystem

    ModuleSystem --> Utils
    ModuleSystem --> |Implements| ynBTC
    ModuleSystem --> |Implements| ynWBNB
    ModuleSystem --> |Implements| ynClisBNB

    ModuleSystem --> SolvProtocol
    ModuleSystem --> SynclubProtocol

    ynBTC --> BSCMainnet
    ynBTC --> BSCTestnet
    ynWBNB --> BSCMainnet
    ynWBNB --> BSCTestnet
    ynClisBNB --> BSCMainnet

    DeployScripts --> BSCMainnet
    DeployScripts --> BSCTestnet

    UnitTests -.-> ModuleSystem
    MainnetTests -.-> BSCMainnet

    %% Click Events
    click KernelProtocol "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/src/interface/external/kernel"
    click YieldnestVault "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/lib/yieldnest-vault"
    click SolvProtocol "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/src/interface/external/solv"
    click SynclubProtocol "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/src/interface/external/synclub"
    click ynBTC "https://github.com/yieldnest/yieldnest-kernel-lrt/blob/dev/deployments/ynBTCk-56.json"
    click ynWBNB "https://github.com/yieldnest/yieldnest-kernel-lrt/blob/dev/deployments/ynWBNBk-56.json"
    click ynClisBNB "https://github.com/yieldnest/yieldnest-kernel-lrt/blob/dev/deployments/ynClisBNBk-56.json"
    click ModuleSystem "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/src/module"
    click Utils "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/src/utils"
    click UnitTests "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/test/unit"
    click MainnetTests "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/test/mainnet"
    click DeployScripts "https://github.com/yieldnest/yieldnest-kernel-lrt/tree/dev/script/bnb"

    %% Styling
    classDef main fill:#f9f,stroke:#333,stroke-width:4px
    classDef protocol fill:#bbf,stroke:#333
    classDef token fill:#bfb,stroke:#333
    classDef module fill:#fbf,stroke:#333
    classDef utils fill:#fbb,stroke:#333
    classDef external fill:#ff9,stroke:#333
    classDef network fill:#9ff,stroke:#333
    classDef testing fill:#f99,stroke:#333
    classDef deployment fill:#9f9,stroke:#333
```
