Skip to main content

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 — holders claim each period’s drop by submitting a merkle proof. See How to claim yield for the end-to-end flow.

Reads

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

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

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);
Always simulate* before write* — simulate runs the transaction against the latest chain state and surfaces revert reasons before the user signs.

Watch events

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