AGFusion Developer & Reviewer Documentation

AGFusion Protocol Documentation

Complete guide to AGFusion: the AI-native stablecoin operating system on Arc Network. Explore our smart contract architecture, native USDC gas economy, agent escrow lifecycles, and Model Context Protocol (MCP) integrations.

1. Overview & Architecture

AGFusion is an AI-assisted stablecoin workspace and agentic command layer built on Arc Network. It eliminates multi-dapp fragmentation by unifying payments, token swaps, cross-chain CCTP bridging, and corporate treasury management into a single, high-performance interface.

// High-Level System Architecture
Web UI (Next.js 15 / React 19 / Viem)
  │
  ├── AI Intent / Function-Calling Loop (Natural Language → Structured Plan)
  ├── Policy Engine & ERC-7715 Autonomous Session Keys
  ├── Blockchain Layer (Arc Testnet 5042002 · Native USDC Gas)
  │    ├── AGFusionDisperse.sol (Single-Signature Batch Payouts)
  │    ├── AGFusionEscrow.sol (Milestone-based Agent Escrow)
  │    └── Circle CCTP v2 (Cross-Chain Settlement Arc ↔ Base Sepolia)
  └── Machine-to-Machine HTTP-402 Micropayment Infrastructure
Core Money-Safety Rule: The AI layer prepares and validates actions. It never holds private keys. On-chain execution remains behind policy boundaries and cryptographic wallet authorization (or scoped session keys).

2. Arc Network & Native USDC Gas

On traditional EVM networks (Ethereum, Arbitrum, Optimism), users must hold volatile native gas tokens (ETH).Arc Network revolutionizes this: native gas is paid directly in USDC (18 decimals).

Arc Testnet Parameters
Chain ID: 5042002 (0x4cef52)
RPC: https://rpc.testnet.arc.network
Explorer: https://testnet.arcscan.app
Gas Token: Native USDC (18 decimals)
Faucet: https://faucet.circle.com
USDC Gas Cost Advantage

A standard 21,000 gas transfer at 1.5 Gwei costs:

21,000 × 1.5e-9 = 0.0000315 USDC

Compared to ~$2.80 on Ethereum L1, Arc provides over 99.9% cost reduction with zero volatile asset exposure.

3. Swap, Send & Cross-Chain CCTP Bridge

AGFusion provides 4 unified money actions directly from the home surface:

Swap
Decentralized Stablecoin Exchange
Live quotes via Arc Uniswap-V2 style DEX router between USDC, EURC, and wrapped assets.
Send
Canonical ERC-20 & Native Transfer
Direct transfer with explicit gas calculation and verification on ArcScan.
Bridge
Circle CCTP Cross-Chain Burn & Mint
Moves native USDC between Arc Testnet and Base Sepolia with server-side attestation tracking.

4. Single-Signature Batch Payouts & CSV Import

Corporate payroll and contractor disbursements on traditional dApps require approving and signing for every recipient individually. AGFusion solves this via AGFusionDisperse.sol:

// Solidity Interface: Single-Signature Disperse
function disperseToken(IERC20 token, address[] calldata recipients, uint256[] calldata values) external;

B2B CSV Import Format

Upload a standard spreadsheet with columns address,amount,label to instantly populate all payout rows:

0x1111111111111111111111111111111111111111,10.5,Lead Engineer
0x2222222222222222222222222222222222222222,8.0,Product Designer
0x3333333333333333333333333333333333333333,5.2,Security Auditor

Use the "Statement" button to export completed disbursements into GAAP-compliant CSV accounting records with ArcScan hashes.

5. On-Chain AI Agent Escrow (AGFusionEscrow.sol)

Rather than simulating agent escrow phases in the UI, AGFusion deploys a verified on-chain escrow contract on Arc:

1. Client funds task:createTask(agent, token, amount, deadline, taskUri)
2. Agent submits proof:submitProof(taskId, proofUri)
3. Client releases payment:releasePayment(taskId)
4. Automated expiration refund:refundExpired(taskId)

6. ERC-7715 Autonomous Session Keys

To power truly autonomous AI workflows without constant wallet popups, AGFusion implements an ERC-7715 scoped session engine:

  • Daily Spend Cap: Hard limit (e.g. 10.00 USDC per day) that resets at 00:00 UTC.
  • Per-Transaction Cap: Prevents rogue large transactions (e.g. max 2.00 USDC per call).
  • Target Whitelist: Only verified contracts (DEX Router, Escrow, Disperse) are authorized.
  • 24-Hour Expiration: Automatically invalidates sessions requiring user renewal.

7. Machine-to-Machine HTTP-402 (x402) Protocol

Arc Network is the ideal home for machine-to-machine commerce. AGFusion implements the HTTP-402 (Payment Required) specification for pay-per-call AI endpoints:

GET /api/x402/agent-service → HTTP 402 Payment Required
Headers: X-Payment-Token: USDC | X-Payment-Amount: 0.001 | X-Payment-ChainId: 5042002

When an agent pays $0.001 USDC on Arc and provides the transaction hash in X-Payment-Tx, the endpoint unlocks live algorithmic liquidity and routing telemetry.

8. AGFusion MCP (Model Context Protocol) Server

AGFusion provides an official MCP Server that connects Claude Desktop, Cursor, and IDE AI agents to Arc Network tools over standard stdio JSON-RPC:

claude_desktop_config.json
{
  "mcpServers": {
    "agfusion-arc": {
      "command": "node",
      "args": ["C:/Users/sayed/.grok/bin/agfusion/mcp/server.mjs"]
    }
  }
}
Exposed Tools: arc_get_network_info, arc_get_balance, arc_estimate_gas_savings, arc_prepare_batch_disperse, and arc_escrow_query.

9. Verified Contracts on ArcScan

AGFusionRegistry
0x76bb5678ec11ae94b34ed9cf90b25c9eea440483
ArcScan Explorer
AGFusionDisperse (Batch Payouts)
contracts/src/AGFusionDisperse.sol
Foundry Tested
AGFusionEscrow (Agent Milestones)
contracts/src/AGFusionEscrow.sol
Foundry Tested

Ready to test AGFusion?

Launch the live unified swap, batch payroll, or agent workspace on Arc Testnet.

Connect wallet

Address only · no funds move on connect

Circle Email Wallet
Use an EVM wallet below for now
Soon
or
Detecting wallets…

Security notes
  • Connecting only reveals your public address. AGFusion never asks for your seed phrase.
  • Sign-in (later) uses a standard login message — not a transfer or token approval. Your wallet should not show a risk warning for a normal SIWE sign-in.
  • Reject any prompt that tries to send assets or set unlimited allowances during connect.
Arc Testnet · Chain ID 5042002 · RPC https://rpc.testnet.arc.network · USDC gas
Network tip: if add-network fails, delete a stale “Arc Testnet” in wallet settings and connect again.