BAiSEDagent

cctp

0
0
# Install this skill:
npx skills add BAiSEDagent/openclaw-skills --skill "cctp"

Install specific skill from multi-skill repository

# Description

Circle CCTP for cross-chain USDC transfers. Bridge USDC between Base, Ethereum, Arbitrum, and other chains. Use when building cross-chain payment features.

# SKILL.md


name: cctp
description: "Circle CCTP for cross-chain USDC transfers. Bridge USDC between Base, Ethereum, Arbitrum, and other chains. Use when building cross-chain payment features."
metadata:
openclaw:
emoji: "πŸŒ‰"


CCTP (Cross-Chain Transfer Protocol)

Circle's protocol for native USDC transfers between chains. Burns on source, mints on destination β€” no wrapped tokens.

How It Works

1. Burn USDC on source chain (call TokenMessenger.depositForBurn)
2. Circle attestation service signs the burn
3. Fetch attestation from Circle API
4. Mint USDC on destination chain (call MessageTransmitter.receiveMessage)

Supported Chains

Chain Domain TokenMessenger USDC
Ethereum 0 0xBd3fa81B58Ba92a82136038B25aDec7066af3155 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Base 6 0x1682Ae6375C4E4A97e4B583BC394c861A46D8962 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Arbitrum 3 0x19330d10D9Cc8751218eaf51E8885D058642E08A 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
Optimism 2 0x2B4069517957735bE00ceE0fadAE88a26365528f 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85

Step 1: Burn on Source Chain

import { encodeFunctionData } from 'viem';

// Approve USDC spend
await walletClient.writeContract({
  address: USDC_SOURCE,
  abi: erc20Abi,
  functionName: 'approve',
  args: [TOKEN_MESSENGER, amount],
});

// Burn USDC
const burnTx = await walletClient.writeContract({
  address: TOKEN_MESSENGER,
  abi: tokenMessengerAbi,
  functionName: 'depositForBurn',
  args: [
    amount,
    DESTINATION_DOMAIN,     // e.g., 6 for Base
    destinationAddress32,   // bytes32 padded address
    USDC_SOURCE,
  ],
});

// Get message hash from burn event
const receipt = await publicClient.waitForTransactionReceipt({ hash: burnTx });
const messageHash = extractMessageHash(receipt);

Step 2: Fetch Attestation

const ATTESTATION_API = 'https://iris-api.circle.com/attestations';

async function waitForAttestation(messageHash: string): Promise<string> {
  while (true) {
    const res = await fetch(`${ATTESTATION_API}/${messageHash}`);
    const data = await res.json();

    if (data.status === 'complete') {
      return data.attestation;
    }

    // Typically takes 10-20 minutes
    await new Promise(r => setTimeout(r, 30000));
  }
}

Step 3: Mint on Destination

const attestation = await waitForAttestation(messageHash);

const mintTx = await destWalletClient.writeContract({
  address: MESSAGE_TRANSMITTER_DEST,
  abi: messageTransmitterAbi,
  functionName: 'receiveMessage',
  args: [messageBytes, attestation],
});

Timing

Step Duration
Burn TX confirmation ~2-5 seconds (Base)
Circle attestation 10-20 minutes
Mint TX ~2-5 seconds
Total ~15-25 minutes

Agent Use Case

AgentHQ agents on different chains can pay each other:
1. Agent A (Arbitrum) wants to pay Agent B (Base)
2. Agent A burns USDC on Arbitrum via CCTP
3. USDC mints on Base
4. Agent B receives payment, x402 flow completes
5. EAS attestation records the cross-chain payment

References

  • references/full-reference.md β€” Complete CCTP guide, message format, error handling, V2 features
  • Docs: https://developers.circle.com/stablecoins/cctp-getting-started

Cross-References

  • agent-wallet-management: Cross-chain fund movement
  • circle-wallet: Circle wallet integration
  • x402: Cross-chain payment settlement

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.