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

# How to deposit USDC into C0

> Mint C0 from USDC end-to-end with @camino-treasury/sdk

This tutorial walks through depositing USDC into C0. By the end, you'll have minted C0 and started accruing yield automatically.

<Card title="View deposit.ts on GitHub" icon="github" href="https://github.com/camino-treasury/js-sdk/blob/main/examples/deposit.ts">
  Runnable script in the SDK repo.
</Card>

## 1. Set up the config

Build a wagmi config with a private key account. (For browser/dApp usage, swap the private key for a connector like `injected()` from `@wagmi/core`.)

```ts theme={null}
import { createConfig, http } from "@wagmi/core";
import { mainnet } from "@wagmi/core/chains";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);

const config = createConfig({
  chains: [mainnet],
  transports: { [mainnet.id]: http(process.env.ETH_RPC_URL) },
});
```

## 2. Approve the SwapFacility to spend USDC

The SwapFacility needs an ERC-20 allowance to pull USDC out of your account.

```ts theme={null}
import {
  waitForTransactionReceipt,
  writeContract,
} from "@wagmi/core";
import { erc20Abi, parseUnits } from "viem";
import { addresses } from "@camino-treasury/sdk";

const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" as const;
const { swapFacility } = addresses[mainnet.id];
const amount = parseUnits("100", 6); // 100 USDC

const approveHash = await writeContract(config, {
  account,
  address: USDC,
  abi: erc20Abi,
  functionName: "approve",
  args: [swapFacility, amount],
});
await waitForTransactionReceipt(config, { hash: approveHash });
```

## 3. Swap USDC → C0

Call `swap` on the SwapFacility to mint C0 1:1 (minus any protocol fees).

```ts theme={null}
import { writeSwapFacilitySwap } from "@camino-treasury/sdk";

const { c0 } = addresses[mainnet.id];

const swapHash = await writeSwapFacilitySwap(config, {
  account,
  address: swapFacility,
  args: [USDC, c0, amount, account.address],
});
await waitForTransactionReceipt(config, { hash: swapHash });
```

After the swap, `account.address` holds 100 C0 and starts accruing yield automatically.

## What's next

* [How to withdraw USDC from C0](/smart-contracts/withdraw) — redeem C0 back to USDC
* [C0 Token](/smart-contracts/c0-token) — the full C0 read/write/watch surface
* [Swap Adapter](/smart-contracts/swap-adapter) — Uniswap V3 routing for USDC/USDT ↔ C0 with built-in slippage protection
