> For the complete documentation index, see [llms.txt](https://docs.liquidcollective.io/sol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidcollective.io/sol/flow_of_funds.md).

# Flow of funds

Below are several sequence diagrams showing flow of funds.

## Deposit Flow

This diagram shows how a user deposits SOL into the stake pool and receives liquid staking tokens.

{% @mermaid/diagram content="       sequenceDiagram
participant User
participant StakePoolProgram
participant ReserveAccount
participant Validator

```
    User->>StakePoolProgram: Deposit SOL or Active Stake Account
    alt User Deposits SOL
        StakePoolProgram->>ReserveAccount: Transfer SOL to Reserve
        StakePoolProgram-->>User: Issue Liquid Staking Tokens (LsSOL)
        Note right of StakePoolProgram: Staking backend later delegates SOL
    else User Deposits Active Stake Account
        StakePoolProgram->>Validator: Verify Stake Account is Delegated
        StakePoolProgram-->>User: Issue Liquid Staking Tokens (LsSOL)
    end
```

" %}

## Withdraw Flow

This diagram illustrates how a user redeems their stake and withdraws SOL.

{% @mermaid/diagram content="sequenceDiagram
participant User
participant StakePoolProgram
participant ReserveAccount
participant Validator

```
    User->>StakePoolProgram: Redeem LsSOL
    StakePoolProgram->>ReserveAccount: Check SOL Availability
    alt Enough SOL in Reserve
        StakePoolProgram->>ReserveAccount: Withdraw SOL
        StakePoolProgram-->>User: Send Withdrawn SOL
    else Not Enough SOL
        StakePoolProgram->>Validator: Unstake Equivalent Stake Account
        Validator-->>User: Receive Deactivating Stake Account
    end
```

" %}

## Pause Flow

This diagram illustrates how an admin pauses staking operations to mitigate risks.

{% @mermaid/diagram content="sequenceDiagram
participant Admin
participant StakePoolProgram
participant Users

```
        Admin->>StakePoolProgram: Call Pause Function
        StakePoolProgram-->>Admin: Confirm Pool is Paused
        Users->>StakePoolProgram: Attempt Deposit/Withdraw (Blocked)
        StakePoolProgram-->>Users: Reject Transaction (Pool is Paused)" %}
```

## Unpause Flow

This diagram illustrates how an admin resumes staking operations.

{% @mermaid/diagram content="sequenceDiagram
participant Admin
participant StakePoolProgram
participant Users

```
    Admin->>StakePoolProgram: Call Unpause Function
    StakePoolProgram-->>Admin: Confirm Pool is Active
    Users->>StakePoolProgram: Deposit/Withdraw Request
    StakePoolProgram-->>Users: Process Transaction Normally" %}
```

## User Allowlisting for Staking

This process ensures that only approved users can deposit SOL into the stake pool.

{% @mermaid/diagram content="sequenceDiagram
participant Admin
participant StakePoolProgram
participant User

```
Admin->>StakePoolProgram: Add User to Allowlist
StakePoolProgram-->>Admin: Confirm User is Added
User->>StakePoolProgram: Attempt to Deposit SOL
StakePoolProgram-->>User: Validate Against Allowlist
alt User is Allowed
    StakePoolProgram-->>User: Accept Deposit and Issue Liquid Staking Tokens (LST)
else User is Not Allowed
    StakePoolProgram-->>User: Reject Deposit (Not on Allowlist)
end" %}
```

## User Allowlisting for Withdrawals

This process ensures that only approved users can withdraw from the stake pool.

{% @mermaid/diagram content="sequenceDiagram
participant Admin
participant StakePoolProgram
participant User

```
Admin->>StakePoolProgram: Add User to Allowlist
StakePoolProgram-->>Admin: Confirm User is Added
User->>StakePoolProgram: Attempt to Withdraw SOL
StakePoolProgram-->>User: Validate Against Allowlist
alt User is Allowed
    StakePoolProgram-->>User: Approve Withdrawal and Send SOL
else User is Not Allowed
    StakePoolProgram-->>User: Reject Withdrawal (Not on Allowlist)
end
```

" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.liquidcollective.io/sol/flow_of_funds.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
