> For the complete documentation index, see [llms.txt](https://doc.brink.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.brink.money/vault/technical-overview/user-operations.md).

# User Operations

### Deposit Flow

Purpose: Deposit ERC20 assets into the vault to receive BrinkVault shares.

Steps:

1. Check Allowance\
   Ensure the vault has permission to transfer your tokens.&#x20;

```javascript
const allowance = await asset.allowance(userAddress, brinkVaultAddress);
```

2. Approve the Vault (if needed)\
   If allowance is lower than the amount you want to deposit:

```javascript
await asset.approve(brinkVaultAddress, depositAmount);
```

3. Deposit Tokens

&#x20;      Returns the number of shares minted.

```javascript
await brinkVault.deposit(depositAmount, userAddress);
```

4. View Balance

```javascript
const shares = await brinkVault.balanceOf(userAddress);
```

### Withdraw Flow

Purpose: Withdraw ERC20 assets by burning vault shares.

Steps:

```javascript
await brinkVault.withdraw(assetAmount, userAddress, userAddress);
```

or to redeem by shares:<br>

```javascript
await brinkVault.redeem(shareAmount, userAddress, userAddress);
```

### View Functions&#x20;

<table><thead><tr><th width="265" align="center">Function </th><th align="center">Description </th></tr></thead><tbody><tr><td align="center">asset()</td><td align="center">Returns the underlying ERC20 asset address.</td></tr><tr><td align="center">totalAssets()</td><td align="center">Returns total asset amount managed by the vault.</td></tr><tr><td align="center">balanceOf(address)</td><td align="center">Returns the user’s vault share balance.</td></tr><tr><td align="center">convertToShares(assets)</td><td align="center">Converts asset amount to equivalent shares.</td></tr><tr><td align="center">convertToAssets(shares)</td><td align="center">Converts shares back to equivalent asset amount.</td></tr><tr><td align="center">previewDeposit(assets)</td><td align="center">Estimates how many shares will be minted for a deposit.</td></tr><tr><td align="center">previewWithdraw(assets)</td><td align="center">Estimates how many shares will be burned for a withdrawal.</td></tr><tr><td align="center">depositLimit()</td><td align="center">Shows the maximum total assets allowed in the vault.</td></tr><tr><td align="center">getBrinkVaultData()</td><td align="center">Returns all configured strategies and their current weights.</td></tr><tr><td align="center">getWhitelist()</td><td align="center">Returns the current list of whitelisted strategies.</td></tr></tbody></table>


---

# 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://doc.brink.money/vault/technical-overview/user-operations.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.
