> For the complete documentation index, see [llms.txt](https://docs.anchored.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anchored.finance/trading-api/cash-operations/deposits.md).

# Deposits

Deposits turn wallet cash tokens into `mUSD` (`mUsdBalance`). See [getting-started/trader-questions.md](/trading-api/getting-started/trader-questions.md) for the API flow and the distinction between wallet balance and `mUSD`.

Deposits may complete instantly if the Cashier `creditBuffer` can cover the `mUSD` credit and the token withdrawal buffer has room. Otherwise they are queued for final cash settlement. See [buffer-mechanism.md](/trading-api/cash-operations/buffer-mechanism.md).

## Pre-authorization

Deposits transfer cash tokens from the user wallet to `Cashier` through `StockRouter`. The user must `approve` `StockRouter` as the spender before deposit:

```
ERC20(tokenAddress).approve(stockRouter, rawTokenAmount)
```

`rawTokenAmount = tokenAmount × 10^tokenDecimals`

### Mainnet cash token and approval spender addresses

| `x-api-chain-id` | Chain            | Cash token                                   | Approval spender (`StockRouter`)             |
| ---------------- | ---------------- | -------------------------------------------- | -------------------------------------------- |
| `8453`           | Base Mainnet     | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | `0x4f090d817fd83753988a7b0c1d76f170f8461be8` |
| `143`            | Monad Mainnet    | `0x754704Bc059F8C67012fEd69BC8A327a5aafb603` | `0x4f090d817fd83753988a7b0c1d76f170f8461be8` |
| `1`              | Ethereum Mainnet | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` | `0x4f090d817fd83753988a7b0c1d76f170f8461be8` |

Check allowance:

```
GET /api/v1/users/{userId}/balance?spenderAddress={spender}
```

Use `tokenBalances[].walletAllowance`.

> Insufficient allowance: `/cash/deposits/calldata` still returns calldata, but the on-chain tx will fail.

Approval owner:

* `/cash/deposits/send` (One Click): API key bound `userAddress`
* `/cash/deposits/calldata` (self-submit): transaction sender wallet

## Build deposit calldata

```
POST /api/v1/cash/deposits/calldata
```

| Field          | Type            | Required | Description              |
| -------------- | --------------- | -------- | ------------------------ |
| `userAddress`  | string          | Yes      | User wallet.             |
| `tokenAddress` | string          | Yes      | Cash token address.      |
| `tokenAmount`  | string / number | Yes      | Amount (human-readable). |

Returns `method: deposit`, `value: "0"`.

## One Click deposit

```
POST /api/v1/cash/deposits/send
```

| Field          | Type            | Required | Description         |
| -------------- | --------------- | -------- | ------------------- |
| `tokenAddress` | string          | Yes      | Cash token address. |
| `tokenAmount`  | string / number | Yes      | Deposit amount.     |
| `gasLimit`     | number          | No       | Optional gas limit. |

Uses API key bound `userAddress` — not a request body field.

## Record deposit tx

```
POST /api/v1/cash/deposits/tx
```

| Field    | Type   | Required | Description      |
| -------- | ------ | -------- | ---------------- |
| `txHash` | string | Yes      | Deposit tx hash. |

## Query deposits

```
GET /api/v1/cash/deposits?page=1&limit=10
GET /api/v1/cash/deposits/{operationId}
```

`operationId` is backfilled by the indexer after parsing chain events.

See [operation-status.md](/trading-api/cash-operations/operation-status.md) for response fields.


---

# 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.anchored.finance/trading-api/cash-operations/deposits.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.
