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

# Deposit & Withdraw Funds

## Overview

Ekiden uses Canton to manage collateral for trading.

Users can deposit supported assets into their funding account and withdraw available collateral.

## Supported collateral

The collateral registry lists every accepted asset, USDCx (the quote, `asset_id` 1) included:

```http theme={null}
GET /api/v1/collateral/assets
```

| Field | Description |
| - | - |
| `asset_id` | Stable id; `1` is the quote (USDCx). |
| `instrument_id` | Canton instrument, `{admin_party}::{id}`. |
| `symbol`, `decimals` | Display symbol and token decimals. |
| `kind` | `stable` or `volatile`. |
| `status` | `active` takes deposits; `reduce_only` takes no new deposits; `disabled` counts as no collateral. Any status can be withdrawn. |
| `initial_weight`, `maintenance_weight` | Share of the asset's value that counts as buying power and as maintenance margin, e.g. `"0.70"`, `"0.85"`. |
| `max_total_deposit`, `max_user_deposit` | Total and per-user caps on trading balances, in whole tokens; `null` when uncapped. |
| `total_deposited`, `cap_utilization` | Current trading balances against the total cap; `null` when uncapped or unknown. |
| `liquidation_discount` | Share of the price credited when liquidation sells the asset, e.g. `"0.95"`; `"0"` for a stablecoin. |
| `closed_market_haircut` | Haircut on the frozen price while the asset's market is closed, e.g. `"0.03"`. |
| `market_session` | `open` or `closed`; a stablecoin is always open. |
| `liquidation_priority` | Order in which stablecoins cover a shortfall after the quote. |

See [Collateral & Margin](https://docs.ekiden.fi/v2/collateral.md) for how these apply.

## Deposits

A deposit is a CIP-56 transfer from your wallet into the asset's Funding vault, submitted from the user's wallet (see [CIP-0056](https://docs.ekiden.fi/wallet/cip-0056.md)).

**1. Create the asset's vaults (first deposit of an asset only)**

```http theme={null}
POST /api/v1/collateral/assets/{asset_id}/vaults
```

Returns `202` while the vaults are created on the ledger; repeating the request is harmless. The quote's vaults exist from registration, so this is for other assets only. Returns `400` when the asset is unknown or not accepting deposits.

**2. Fetch the contracts to disclose**

```http theme={null}
GET /api/v1/collateral/assets/{asset_id}/disclosures
```

Returns the live `collateral_registry` and the asset's `funding_fee_config` (each as a disclosed contract: `templateId`, `contractId`, `createdEventBlob`, `synchronizerId`) and the asset's `fees`. The registry contract is replaced whenever the registry changes, so fetch it right before submitting.

**3. Submit the deposit**

Exercise `DepositIntoFundingAsset` on your user contract with `collateralRegistryCid` and `fundingFeeConfigCid` from the previous step, disclosing both contracts. The transfer is `amount + fees.deposit`; your Funding balance is credited `amount`.

To trade with the asset, transfer it from your Funding to your Trading account. A transfer that would exceed the asset's `max_total_deposit` or `max_user_deposit` is rejected and the funds stay in Funding.

## Withdrawals

Exercise `WithdrawFromFunding` with the asset's `fundingFeeConfigCid`. Your unlocked Funding balance must cover `amount + fees.withdraw`; you receive `amount`.

> [!NOTE]
>
> Withdrawals of assets other than USDCx settle as a direct CIP-56 transfer, so your party needs a transfer preapproval for that asset.

## Fees

`fees.deposit` and `fees.withdraw` in the disclosures response are flat amounts in whole tokens of the asset, exactly what the ledger charges (e.g. `"0.0005"`, or `"0.00"` when there is no fee). Size a submission from the `fees` and the `funding_fee_config` of the same response.


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