# Async Deposit and Redeem

Though [deposit and redeem handlers are totally arbitrary](/onyx-protocol/architecture/deposit-and-redeem.md), most will follow an asynchronous approach with 3 steps:

1. Create request
2. Execute batched requests
3. Distribute shares (deposit) or assets (redeem); can be synchronous with (2)

## Deposit

### Request

{% @mermaid/diagram content="sequenceDiagram
actor U as Investor
participant DQ as DepositHandler
participant Asset as ERC20

```
U->>DQ: request deposit:<br/>- $assetAmount
DQ-->>DQ: validate request
DQ->>DQ: record request
DQ->>Asset: transferFrom()
Asset->>DQ: transfer $assetAmount" %}
```

### Fulfillment

{% @mermaid/diagram content="sequenceDiagram
actor Admin as Admin
participant DQ as DepositHandler
participant VH as ValuationHandler
participant FH as FeeHandler
participant Asset as DepositAsset
participant S as Shares
actor User as Investor

```
Admin->>DQ: execute requests:<br />- $requests
DQ->>VH: get:<br/>- share price<br />- asset rate
VH-->>DQ: share price, asset rate
DQ-->>DQ: calculate shares due for $requests
DQ-->>DQ: calculate total assets for $requests
DQ->>FH: settle entrance fee
DQ->>Asset: transfer()
Asset->>S: transfer total assets
DQ->>S: mint
Note over S, User: possibly separate claim step
S->>User: transfer shares" %}
```


---

# Agent Instructions: 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:

```
GET https://docs.enzyme.finance/onyx-protocol/general-flows/async-deposit-and-redeem.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
