Skip to main content

Overview

Camino Treasury lets you deposit USDC or USDT into the C0 yield-bearing token to earn returns on idle funds. The API provides unsigned transactions that you sign and submit on-chain. You can withdraw back to stablecoins at any time.

Prerequisites

1. Prepare a Deposit

Get the unsigned transactions needed to deposit USDC or USDT into C0:
const chainId = 1;

const response = await fetch(
  `https://api.caminotreasury.com/v1/${chainId}/deposit/prepare`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'your-api-key'
    },
    body: JSON.stringify({
      token: 'USDC',
      amount: '1000',
      from: '0x742d35cc6634c0532925a3b844bc454e4438f44e',
      recipient: '0x742d35cc6634c0532925a3b844bc454e4438f44e'
    })
  }
);

const { steps, summary } = await response.json();

// steps:
// [
//   {
//     "type": "approve",
//     "description": "Approve USDC spending",
//     "transaction": { "to": "0xA0b8...", "data": "0x095e...", "value": "0x0" }
//   },
//   {
//     "type": "swap",
//     "description": "Deposit USDC for C0",
//     "transaction": { "to": "0xB680...", "data": "0x6e81...", "value": "0x0" }
//   }
// ]
//
// summary:
// {
//   "tokenIn": "USDC",
//   "tokenOut": "C0",
//   "amountIn": "1000",
//   "amountInRaw": "1000000000"
// }
FieldTypeDescription
tokenstringInput token — USDC or USDT
amountstringHuman-readable amount to deposit
fromstringAddress that holds the tokens
recipientstringAddress that receives C0
The response contains an array of steps that must be signed and submitted in order. Each step includes an unsigned transaction object with to, data, and value fields.

Step types

TypeDescription
approveApprove the token spending allowance
reset-approvalReset USDT allowance to zero before setting a new one
swapExecute the deposit swap
USDT requires resetting the allowance to zero before approving a new amount. The API handles this automatically — if a reset-approval step is included, submit it before the approve step.

2. Prepare a Withdrawal

Get the unsigned transactions to withdraw C0 back to USDC or USDT:
const chainId = 1;

const response = await fetch(
  `https://api.caminotreasury.com/v1/${chainId}/withdraw/prepare`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'your-api-key'
    },
    body: JSON.stringify({
      token: 'USDC',
      amount: '500',
      from: '0x742d35cc6634c0532925a3b844bc454e4438f44e',
      recipient: '0x742d35cc6634c0532925a3b844bc454e4438f44e'
    })
  }
);

const { steps, summary } = await response.json();

// steps:
// [
//   {
//     "type": "approve",
//     "description": "Approve C0 spending",
//     "transaction": { "to": "0x00c0...", "data": "0x095e...", "value": "0x0" }
//   },
//   {
//     "type": "swap",
//     "description": "Withdraw C0 for USDC",
//     "transaction": { "to": "0xB680...", "data": "0x04db...", "value": "0x0" }
//   }
// ]
//
// summary:
// {
//   "tokenIn": "C0",
//   "tokenOut": "USDC",
//   "amountIn": "500",
//   "amountInRaw": "500000000"
// }
FieldTypeDescription
tokenstringOutput token — USDC or USDT
amountstringAmount of C0 to withdraw
fromstringAddress that holds C0
recipientstringAddress that receives the stablecoin

3. Estimate Yield

Get yield projections for a wallet’s C0 balance:
const chainId = 1;
const address = '0x742d35cc6634c0532925a3b844bc454e4438f44e';

const response = await fetch(
  `https://api.caminotreasury.com/v1/${chainId}/yield?address=${address}`,
  { headers: { 'x-api-key': 'your-api-key' } }
);

const { earning, decimals, rate, dailyYield, monthlyYield, annualYield } =
  await response.json();

// {
//   "earning": "5000000000",
//   "decimals": 6,
//   "rate": { "apy": 0.03047 },
//   "dailyYield": "417",
//   "monthlyYield": "12500",
//   "annualYield": "152373"
// }
FieldTypeDescription
earningstringCurrent C0 balance in raw units
decimalsintegerToken decimal places (6)
rate.apynumberNet annual percentage yield
dailyYieldstringEstimated daily yield in raw units
monthlyYieldstringEstimated monthly yield in raw units
annualYieldstringEstimated annual yield in raw units
To convert raw yield values to human-readable amounts:
const monthly = Number(monthlyYield) / 10 ** decimals;
// 12500 / 1e6 = 0.0125 USDC

Next Steps