> ## 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.

# C0 Token

> Read balances, allowances, and total supply; transfer C0 and approve spenders

## Overview

C0 is the Camino stablecoin (ERC-20, 6 decimals). The SDK exports the standard ERC-20 surface plus a few C0-specific reads for supply state.

Yield is distributed weekly via the [Yield Distributor](/smart-contracts/yield-distributor) — holders claim each period's drop by submitting a merkle proof. See [How to claim yield](/smart-contracts/claim-yield) for the end-to-end flow.

## Reads

```ts theme={null}
import { createConfig, http } from "@wagmi/core";
import { mainnet } from "@wagmi/core/chains";
import {
  readC0BalanceOf,
  readC0TotalSupply,
  readC0Allowance,
  addresses,
} from "@camino-treasury/sdk";

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

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

// Balance for any address
const balance = await readC0BalanceOf(config, {
  address: c0,
  args: ["0xUserAddress"],
});

// Global supply
const supply = await readC0TotalSupply(config, { address: c0 });

// How much of `owner`'s balance `spender` is approved to move
const allowance = await readC0Allowance(config, {
  address: c0,
  args: ["0xOwner", "0xSpender"],
});
```

## Writes

For server-side / Node.js usage, build a config with a private key account. For browser/dApp usage, build the config with a connector (e.g. `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) },
});
```

### Transfer

```ts theme={null}
import {
  simulateC0Transfer,
  writeC0Transfer,
  addresses,
} from "@camino-treasury/sdk";

// 100 C0 (6 decimals)
const amount = 100_000_000n;

const { request } = await simulateC0Transfer(config, {
  account,
  address: addresses[mainnet.id].c0,
  args: ["0xRecipient", amount],
});

const txHash = await writeC0Transfer(config, request);
```

### Approve

```ts theme={null}
import { simulateC0Approve, writeC0Approve, addresses } from "@camino-treasury/sdk";

const { request } = await simulateC0Approve(config, {
  account,
  address: addresses[mainnet.id].c0,
  args: [
    addresses[mainnet.id].swapFacility, // spender
    100_000_000n,                       // 100 C0
  ],
});

await writeC0Approve(config, request);
```

<Note>
  Always `simulate*` before `write*` — simulate runs the transaction against the latest chain state and surfaces revert reasons before the user signs.
</Note>

## Watch events

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

const unwatch = watchC0TransferEvent(config, {
  address: addresses[mainnet.id].c0,
  onLogs: (logs) => {
    for (const log of logs) {
      console.log(log.args.from, "→", log.args.to, log.args.value);
    }
  },
});

// stop watching
unwatch();
```

`Approval` and `Transfer` both have matching `watchC0*Event` exports; IDE autocomplete on `watchC0` will list every event on the contract. For yield-distribution events specifically, see the [Yield Distributor](/smart-contracts/yield-distributor) page.
