> For the complete documentation index, see [llms.txt](https://docs.enzyme.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enzyme.finance/onyx-protocol/general-flows/async-deposit-and-redeem.md).

# 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
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.enzyme.finance/onyx-protocol/general-flows/async-deposit-and-redeem.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.
