> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fragmetric.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

## **FRAG-22 : Fund Module**

### **Overview**

The Fund module serves as the core liquidity management, and accounting engine within the FRAG-22 ecosystem. It securely manages user deposits and withdrawals, maintains precise onchain records, and ensures liquidity efficiency. By providing robust fund management and transparent accounting, it lays the foundation for secure and efficient decentralized asset management.

```mermaid theme={null}
graph TD

%% User interactions
User[User] -- Deposit Request --> DepositValidation
User -- Withdrawal Request --> WithdrawalValidation

subgraph Fund Module

%% Deposit Flow (Blue Arrows)
DepositValidation -->|Validated| AccountManagement
AccountManagement -->|Update User Balance & Mint Receipt Tokens| ReserveManagement
ReserveManagement -->|Allocate Assets| YieldManagement

%% Withdrawal Flow (Orange Arrows)
WithdrawalValidation -->|Validated| WithdrawalQueue
WithdrawalQueue -->|Batch Processing| LiquidityReserveCheck
LiquidityReserveCheck -->|Liquidity Sufficient| ReserveManagement
LiquidityReserveCheck -->|Liquidity Insufficient| AssetRebalancing
AssetRebalancing -->|Replenish Reserve| ReserveManagement
ReserveManagement -->|Process Withdrawal| WithdrawalProcessing
WithdrawalProcessing -->|Update User Balance & Burn Receipt Tokens| AccountManagement

%% On-chain Accounting Records (Tracks all operations)
AccountManagement --> OnChainAccountingRecords
ReserveManagement --> OnChainAccountingRecords
YieldManagement --> OnChainAccountingRecords
WithdrawalProcessing --> OnChainAccountingRecords
end

%% Feedback to User
OnChainAccountingRecords -->|Confirm Transaction| User

%% Styling the arrows with distinct colors
linkStyle 0 stroke:#00AEEF,stroke-width:2px,color:#00AEEF
linkStyle 1 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 2 stroke:#00AEEF,stroke-width:2px,color:#00AEEF
linkStyle 3 stroke:#00AEEF,stroke-width:2px,color:#00AEEF
linkStyle 4 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 5 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 6 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 7 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 8 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 9 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 10 stroke:#00AEEF,stroke-width:2px,color:#00AEEF
linkStyle 11 stroke:#00AEEF,stroke-width:2px,color:#00AEEF
linkStyle 12 stroke:#00AEEF,stroke-width:2px,color:#00AEEF
linkStyle 13 stroke:#F7941D,stroke-width:2px,color:#F7941D
linkStyle 14 stroke:#00AEEF,stroke-width:2px,color:#00AEEF

classDef user fill:#0078D4,color:#ffffff
classDef internal fill:#34A853,color:#ffffff

class User user
class DepositValidation,WithdrawalValidation,WithdrawalQueue,AccountManagement,ReserveManagement,YieldManagement,LiquidityReserveCheck,WithdrawalProcessing,AssetRebalancing,OnChainAccountingRecords internal
```
