> ## Documentation Index
> Fetch the complete documentation index at: https://docs.multiliquid.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Deposit

> Swap USDC for TSY from an onboarded wallet, and track the deposit until it is final.

A deposit is an instant swap of USDC for \$TSY through the Treasury capital provider. The swap mints \$TSY 1:1 to the depositor's wallet and records the same amount of Treasury credits for it. You quote it, build it, have the wallet sign it, and submit it, as for any [instant swap](https://docs.multiliquid.xyz/api-reference/swap/swap-instantly.md).

## Before you start

* **An onboarded wallet**, on the \$TSY allowlist. [Onboarding](https://docs.multiliquid.xyz/api-reference/treasury/onboarding.md) explains how to get there.
* **USDC and ETH in that wallet**, on Ethereum mainnet. The wallet pays network fees in ETH.
* **The token addresses**, from `GET /v1/swap/pairs?network=evm-mainnet`, as [Discovery](https://docs.multiliquid.xyz/api-reference/swap/discovery.md#pairs) describes. The USDC-to-\$TSY pair lists one capital provider, the Treasury capital provider.

## 1. Quote

Fix the USDC to deposit as `amountIn`, in whole tokens with at most 6 decimal places, and pass the depositor's wallet as `user`. 1,000 USDC is `1000`.

```bash theme={null}
curl "https://api.multiliquid.xyz/v1/swap/quote?network=evm-mainnet&inputToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&outputToken=0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32&amountIn=1000&user=0x1111111111111111111111111111111111111111"
```

```json Response expandable theme={null}
{
  "network": "evm-mainnet",
  "swapType": "exactIn",
  "inputToken": {
    "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "symbol": "USDC",
    "name": "USD Coin",
    "decimals": 6,
    "kind": "stablecoin",
    "issuer": "Circle"
  },
  "outputToken": {
    "address": "0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32",
    "symbol": "TSY",
    "name": "Treasury",
    "decimals": 18,
    "kind": "stablecoin",
    "issuer": "Multiliquid"
  },
  "amountIn": "1000",
  "amountOut": "1000",
  "price": "1",
  "nav": [],
  "fees": [
    {
      "type": "issuer",
      "amount": "0",
      "token": {
        "address": "0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32",
        "symbol": "TSY",
        "name": "Treasury",
        "decimals": 18,
        "kind": "stablecoin",
        "issuer": "Multiliquid"
      },
      "paidBy": "capitalProvider"
    },
    {
      "type": "spread",
      "amount": "0",
      "token": {
        "address": "0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32",
        "symbol": "TSY",
        "name": "Treasury",
        "decimals": 18,
        "kind": "stablecoin",
        "issuer": "Multiliquid"
      },
      "paidBy": "user"
    },
    {
      "type": "capitalProvider",
      "amount": "0",
      "token": {
        "address": "0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32",
        "symbol": "TSY",
        "name": "Treasury",
        "decimals": 18,
        "kind": "stablecoin",
        "issuer": "Multiliquid"
      },
      "paidBy": "user"
    }
  ],
  "capitalProvider": {
    "id": "0x780a0ed07e618523cabd294ee648537f4d185a074f97ecd50188d7f394e1e927",
    "name": "Uniform Labs",
    "address": "0x1f2c73a2578b3d49843c9a40f473ef6768f6d6a3"
  },
  "indicative": false,
  "alternatives": []
}
```

1,000 USDC mints 1,000 \$TSY: `amountOut` is `1000`. The `fees` the depositor pays are already in the amounts, and here they are zero.

## 2. Build

Send the same deposit with the `user`. Leave out `receiver`, so the \$TSY goes to the depositor, the wallet that also holds the credits.

```bash theme={null}
curl -X POST "https://api.multiliquid.xyz/v1/swap/build" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "evm-mainnet",
    "inputToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "outputToken": "0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32",
    "amountIn": "1000",
    "user": "0x1111111111111111111111111111111111111111",
    "slippageBps": 50
  }'
```

```json Response (quote omitted) expandable theme={null}
{
  "bound": {
    "minAmountOut": "995"
  },
  "approval": {
    "description": "Approve 1000 USDC to the Treasury delegate of capital provider Uniform Labs",
    "transaction": {
      "runtime": "evm",
      "chainId": 1,
      "from": "0x1111111111111111111111111111111111111111",
      "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "data": "0x095ea7b30000000000000000000000001f2c73a2578b3d49843c9a40f473ef6768f6d6a3000000000000000000000000000000000000000000000000000000003b9aca00",
      "value": "0",
      "nonce": "0",
      "gas": "66669",
      "maxFeePerGas": "1047413542",
      "maxPriorityFeePerGas": "101592",
      "serialized": "0x02f86c018083018cd8843e6e43268301046d94a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4880b844095ea7b30000000000000000000000001f2c73a2578b3d49843c9a40f473ef6768f6d6a3000000000000000000000000000000000000000000000000000000003b9aca00c0"
    }
  },
  "swap": {
    "description": "Swap 1000 USDC for at least 995 TSY",
    "transaction": {
      "runtime": "evm",
      "chainId": 1,
      "from": "0x1111111111111111111111111111111111111111",
      "to": "0xd66211cf522ba23b59789fff6524c1f03e13e20c",
      "data": "0xdeead6b5…",
      "value": "0",
      "nonce": "1",
      "gas": null,
      "maxFeePerGas": "1047413542",
      "maxPriorityFeePerGas": "101592",
      "serialized": null
    }
  },
  "checks": {
    "balance": {
      "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "required": "1000",
      "available": "1528.855507",
      "sufficient": true
    },
    "eligibility": {
      "wallet": "0x1111111111111111111111111111111111111111",
      "token": "0x6f4e688a151dfa05b20cb3151e6066d9fd5d7b32",
      "status": "ineligible",
      "reason": "notAllowlisted",
      "action": "The TSY allowlist does not include 0x1111111111111111111111111111111111111111, or its blacklist does, so the swap would revert. Ask Multiliquid to add the wallet to the TSY allowlist, or receive TSY in another wallet."
    },
    "allowance": {
      "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "spender": "0x1f2c73a2578b3d49843c9a40f473ef6768f6d6a3",
      "required": "1000",
      "available": "0",
      "sufficient": false
    },
    "simulation": {
      "status": "reverted",
      "error": {
        "name": "AccountNotWhitelisted",
        "message": "0x1111111111111111111111111111111111111111 is not on the TSY allowlist"
      }
    }
  }
}
```

The example wallet is not on the \$TSY allowlist, so `eligibility` is `ineligible` and its `action` says what to do. Its swap reverts in simulation after the approval, so `checks.simulation` is `reverted`, and the swap's `gas` and `serialized` are `null`: it cannot succeed as built. For an onboarded wallet, `eligibility.status` is `eligible`, `reason` is `allowlisted`, and there is no `action`; the simulation passes, and the swap carries its `gas` and `serialized`.

The depositor signs at most two transactions, in this order:

* **`approval`:** lets the Treasury delegate take exactly the USDC this deposit needs. It is `null` when the wallet has already approved enough.
* **`swap`:** the deposit itself. It mints the \$TSY and records the credits.

Before asking for a signature, read `checks`:

| Check | When it fails | What to do |
| - | - | - |
| `eligibility` | `status` is `ineligible`, with reason `notAllowlisted` | The receiver is not on the \$TSY allowlist, or is on its blacklist. Finish [onboarding](https://docs.multiliquid.xyz/api-reference/treasury/onboarding.md) for the wallet, or deposit from an onboarded one. |
| `eligibility` | `status` is `unknown`, with reason `checkFailed` | The allowlist did not answer. Build again later. |
| `balance` | The wallet holds less USDC than `required` | Fund the wallet, or deposit less |
| `allowance` | The allowance is below `required` | Nothing: the build adds an `approval` for exactly that amount |
| `simulation` | `status` is `reverted` | Show `error.message`: the deposit would fail as built |

A failed check never fails the build. Don't ask a wallet that is `ineligible` to sign: its approval would land and cost a network fee, and then its swap would fail.

## 3. Sign and submit

The wallet signs the `approval`, when there is one, and the `swap`, without broadcasting either. Send both to `POST /v1/submissions` in one request, in signing order:

```bash theme={null}
curl -X POST "https://api.multiliquid.xyz/v1/submissions" \
  -H "Content-Type: application/json" \
  -d '{ "network": "evm-mainnet", "signedTransactions": ["0x02f8…", "0x02f8…"] }'
```

Each transaction carries its nonce, gas, and fees, read from the chain, and the swap's nonce follows the approval's: sign each `serialized` as returned. Multiliquid broadcasts the approval and sends the swap once the approval is `confirmed`. [Swap instantly](https://docs.multiliquid.xyz/api-reference/swap/swap-instantly.md#3-sign-and-submit) covers what to do with a wallet that can only broadcast, such as a custody platform.

## 4. Track until final

Read the swap's submission with `GET /v1/submissions/{submissionId}` until its `state` is `finalized`. Record the deposit as complete only then: a chain reorganization can return a `confirmed` swap to `pending`. [Submissions](https://docs.multiliquid.xyz/api-reference/swap/submissions.md) lists every state.

Once the deposit is final:

* **The wallet holds the \$TSY.** It can transfer it freely, but only the depositor can redeem it.
* **The credits start earning 24 hours after the deposit.** A deposit redeemed before then is redeemed at par, without yield.
* **To redeem,** quote \$TSY for USDC with the depositor as `user`, as [Redeem](https://docs.multiliquid.xyz/api-reference/treasury/redeem.md) shows.

## Deposit an RWA

The Treasury capital provider also takes tokenized money market funds in kind. `GET /v1/swap/pairs` lists each RWA-to-\$TSY pair, such as WTGXX to \$TSY. The flow is the same: quote, build, sign, submit. The build's `approval` approves the RWA instead of USDC, and an RWA deposit earns from its deposit day. Credits from an RWA deposit are redeemable for USDC like any other.

## When something goes wrong

| Code | What happened | What to do |
| - | - | - |
| `NO_QUOTE` | The Treasury capital provider cannot take the deposit now | Show the reason in `details.providers`, and try again later |
| `BOUND_NOT_MET` | The price moved past the bound you sent | Quote again |
| `SIMULATION_FAILED` | The signed swap would revert now, as when the receiver is not on the \$TSY allowlist | Show the message. Check `checks.eligibility` with a new build, then sign again. |
| `NONCE_ALREADY_USED` | Another transaction used the wallet's nonce | Build and sign again |
| `SERVICE_UNAVAILABLE` on submit | The broadcast may or may not have reached the network | Send the same request again. Never sign new transactions: both could land. |

[Swap instantly](https://docs.multiliquid.xyz/api-reference/swap/swap-instantly.md#when-something-goes-wrong) and [Errors](https://docs.multiliquid.xyz/api-reference/guides/errors.md) list every other code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.