Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

28 Commits

Repository files navigation

synarc-agent-sdk

The official SDK for SynArc — build Creator DAOs, autonomous treasury agents, and cross-chain payment flows on the Arc Network.

Most community treasury tools require manual intervention, governance bottlenecks, and fragile bridging mechanics. SynArc fixes that by combining milestone-gated Creator DAOs, an Automated Treasury Guard, and Circle CCTP into one composable SDK.


Features

  • Creator DAO Deployment — Deploy SynArcCrowdfund escrow contracts directly from your wallet. Funds are milestone-gated and only released to the creator when the community approves.
  • USDC Nanopayments — Direct micro-payments to creator wallets on Arc Network; any amount from $0.01 upward.
  • Automated Treasury Guard — Autonomous agent supporting Auto Rebalancing (CCTP), Auto Payments (scheduled with 24h timelock), and Risk Monitoring with emergency pause.
  • Bidirectional CCTP Bridge — Native Circle burn-and-mint; Arc Testnet ↔ Ethereum Sepolia without wrapper tokens.
  • Wallet-Agnostic — MetaMask, Privy, Circle Programmable Wallets, Coinbase, WalletConnect, or raw private keys.
  • Read-Only Mode — Query balances, campaigns, and treasury stats without connecting a wallet.

Install

npm install synarc-agent-sdk

Deployed Contracts & Network Reference

Below is the official network configuration and deployed smart contract addresses for SynArc on the Arc Testnet (chainId: 5042002).

Configuration / ContractValue / AddressDescription
Chain ID5042002Arc Testnet Chain Identifier
RPC Endpointhttps://rpc.testnet.arc-node.thecanteenapp.com/v1/swrm_104d24688adcae992878acabfd41b2ed5800817b20d57aa9b17a64d225c0bf8fPrimary RPC endpoint for client node calls
SynArcGovernor0x83Fa2adf3f66e4951D7E9F2576a79e9d644aE25eGovernance proposal and voting controller
Governance Treasury (treasuryGovernance)0xFE0F6bF45D363d34CD5fC1781594a7471736dC18Timelocked treasury for core DAO balances
Agent Operating Treasury (treasuryAgent)0x302D7cba3553e22E24C7A5C9aFee3942EBC6ea63Fast-access agent operating reserves
Crowdfund Factory / Template0xd5374DFC4B01F60115A52Df027704062506b3030Deploys new campaign milestone escrows
SynArcToken (sARC)0xBd0C6b83DaBF2c04Ab762C262ea0B036d2D1368ePrimary governance voting weight token
EURC Token0x89B50855Aa3bE2F677cD6303Cec089B5F319D72aEURC stablecoin contract address
USDC (Gas Token)0x3600000000000000000000000000000000000000Native USDC stablecoin for fee payment
Treasury Agent Contract0x88BdF819466C1802ce6C780a9fbdF3A314cab07DOn-chain autonomous agent rules executor
CCTP Token Messenger0xd0C3da4E20F0D24dB1cE8f1fF36814Ea8F60309eCircle CCTP Token Messenger address

Two-Treasury Architecture

SynArc uses two separate treasury contracts by design:

  • Governance Treasury (0xFE0F6bF45D363d34CD5fC1781594a7471736dC18) — The community-visible, timelocked treasury. All user-facing balance displays, governance proposals, and dashboard stats read from this contract. Withdrawals require a passing governance vote and a 24-hour timelock delay.
  • Agent Operating Treasury (0x302D7cba3553e22E24C7A5C9aFee3942EBC6ea63) — Used exclusively by the autonomous treasury agent for instant CCTP rebalances. Not surfaced to end users. Funded via governance-approved transfers from the main treasury.

Import the correct address for your use case:

import{TREASURY_GOVERNANCE_ADDRESS,TREASURY_AGENT_ADDRESS}from'synarc-agent-sdk'

Circle & Agent Integrations Reference

SynArc integrates with the Circle ecosystem and autonomous systems to power its rebalancing, governance, and onboarding systems:

  • Circle CCTP (Cross-Chain Transfer Protocol)Fully Deployed & Functional: Handles native burn-and-mint USDC routing between Arc Testnet and Ethereum Sepolia. In lib/agent/cctp-executor.ts, the system executes burns, polls Circle's Iris attestation API for validation consensus, and triggers mint receipts on the destination Messenger contract.
  • Circle Gateway (x402 Nanopayments)Simulated/Planned: Tracks AI model execution fees for each inference call in lib/agent/gateway-payments.ts. The codebase contains hooks to deduct USDC internally for every Groq API request, awaiting live production endpoints to route actual on-chain fee payments.
  • Modular Wallets (ERC-4337 & Social Auth)Fully Deployed & Functional: Provisioned dynamically for users using Privy social logins and Circle's Web3 Services (W3S). In lib/tx-helper.ts, transactions submitted by Circle embedded wallets are routed via custom EIP-1193 providers and sponsored gaslessly via paymasters.
  • Groq AIFully Deployed & Functional: Powers the agent's real-time treasury analysis engine in lib/agent/treasury-agent.ts. The agent script calls the Groq SDK using the qwen/qwen3.6-27b model to evaluate current balances and autonomously execute or queue rebalancing decisions.
  • ERC-8004 Identity RegistryFully Deployed & Functional: Deployed registry contract (0x8004A818BFB912233c491871b3d84c89A494BD9e) registers agent identity autonomously on-chain.

Quick Start

Read-Only (Check Balances)

import{SynArc,SYNARC_TESTNET}from'synarc-agent-sdk'constsynarc=newSynArc({governorAddress: SYNARC_TESTNET.governor,treasuryAddress: SYNARC_TESTNET.treasury,tokenAddress: SYNARC_TESTNET.token,})constbalance=awaitsynarc.getTreasuryBalance()console.log(`Treasury: ${balance.usdc} USDC / ${balance.eurc} EURC`)

Sync Direct Transfers (Fund Agent Treasury)

If a treasury receives USDC via direct ERC20 transfers (e.g., from governance-gated funding transfers to the Agent Operating Treasury), you must sync the internal balance tracking variables:

import{SynArc,SYNARC_TESTNET,TREASURY_AGENT_ADDRESS}from'synarc-agent-sdk'constsynarc=newSynArc({
...SYNARC_TESTNET,provider: window.ethereum,})// Trigger balance sync on the Agent Operating TreasuryconsttxHash=awaitsynarc.syncBalance(TREASURY_AGENT_ADDRESS)console.log(`Balances synced! Tx: ${txHash}`)

Fan Nanopayment (Direct USDC Support)

constsynarc=newSynArc({
...SYNARC_TESTNET,provider: window.ethereum,// EIP-1193 provider})// Send $5 USDC directly to a creator's walletconsttxHash=awaitsynarc.supportCreator('0xCreatorWalletAddress',5.00)console.log(`Payment sent! Tx: ${txHash}`)

Creator DAO

The Creator DAO system deploys an isolated SynArcCrowdfund escrow contract directly from the user's wallet. Supporters fund the escrow; funds are released to the creator when milestones pass community vote.

createCreatorDAO

Deploy a new Creator DAO escrow contract:

import{SynArc,SYNARC_TESTNET}from'synarc-agent-sdk'constsynarc=newSynArc({
...SYNARC_TESTNET,provider: window.ethereum,creatorApiUrl: 'https://api.synarcdao.xyz',// optional: auto-registers campaign})consttxHash=awaitsynarc.createCreatorDAO({name: 'Debut EP — Kelly Music',description: 'Fund the production and release of my debut EP on Arc Network.',goalUSDC: 500,durationDays: 30,recipientWallet: '0xYourWalletAddress',// optional, defaults to callerimageUrl: 'https://example.com/cover.jpg',// optionaltemplate: 'music',})console.log(`Creator DAO deployed! Tx: ${txHash}`)

Parameters (CreatorDAOParams):

FieldTypeRequiredDescription
namestringCampaign / project name
descriptionstringShort description of the creator's goal
goalUSDCstring | numberTarget funding amount in USDC (also accepts goal)
durationDaysnumberCampaign duration in days (default: 30, range: 7–90)
recipientWallet0x${string}Payout wallet; defaults to caller's address (also accepts recipient)
imageUrlstringCover image URL for the campaign
templateCreatorDAOTemplateCampaign type: 'music' | 'art' | 'writing' | 'software' | 'general'
isAgentbooleanSet true for AI agent treasury funds
categorystringCategory label override

supportCreatorDAO

Fund a deployed Creator DAO escrow. Approves USDC and calls fund() on the contract:

// Fund a Creator DAO with 50 USDCconsttxHash=awaitsynarc.supportCreatorDAO('0xEscrowContractAddress',50)console.log(`Funded! Tx: ${txHash}`)

getCreatorDAO

Read on-chain data from a deployed SynArcCrowdfund contract:

constdao=awaitsynarc.getCreatorDAO('0xEscrowContractAddress')console.log(dao.title)// 'Debut EP — Kelly Music'console.log(dao.goal)// '500.000000'console.log(dao.raised)// '320.000000'console.log(dao.contributors)// 12console.log(dao.state)// 'Active'console.log(dao.milestones)// [{ title, amount, description, status }]

Returns (CreatorDAO):

FieldTypeDescription
idstringEscrow contract address
titlestringCampaign title
descriptionstringCampaign description
categorystringCategory label
goalstringFunding goal in USDC
raisedstringAmount raised so far
contributorsnumberNumber of unique contributors
state'Active' | 'Voting' | 'Completed' | 'Refunded'Campaign state
isAgentbooleanWhether this is an AI agent fund
creator0x${string}Deployer wallet
recipient0x${string}Payout wallet
deadlinestringISO timestamp of campaign deadline
milestonesCreatorDAOMilestone[]Milestone list
escrowAddress0x${string}Escrow contract address

getCreatorDAOs

List active Creator DAO campaigns (fetches from creatorApiUrl if configured):

constdaos=awaitsynarc.getCreatorDAOs()daos.forEach(d=>{console.log(`${d.title}${d.raised}/${d.goal} USDC (${d.state})`)})

Milestone Escrow Backer Voting

Once a Creator DAO campaign is launched and funded, backing capital is milestone-gated. Backers can vote to release milestones or claim refunds:

// 1. Backers vote to approve a completed milestone (voted weight matches their contribution)constapproveTx=awaitsynarc.approveMilestone('0xEscrowContractAddress',0)// milestone indexconsole.log(`Voted to approve milestone! Tx: ${approveTx}`)// 2. Creator/recipient withdraws milestone budget after approval (>50% support)constwithdrawTx=awaitsynarc.withdrawMilestone('0xEscrowContractAddress',0)console.log(`Milestone budget withdrawn! Tx: ${withdrawTx}`)// 3. Backers claim their USDC refund if campaign fails to reach goal before deadlineconstrefundTx=awaitsynarc.claimRefund('0xEscrowContractAddress')console.log(`Refund claimed! Tx: ${refundTx}`)

supportCreator

Send a direct USDC nanopayment straight to a creator's wallet (not an escrow):

// Send $0.10 micropaymentawaitsynarc.supportCreator('0xCreatorWalletAddress',0.10)// AI agent sends $5.00 autonomouslyawaitsynarc.supportCreator('0xCreatorWalletAddress',5.00)

getCreatorProfile

Fetch a creator's on-chain stats merged with optional off-chain metadata:

// By wallet addressconstprofile=awaitsynarc.getCreatorProfile('0xCreatorWalletAddress')// By slug — requires creatorApiUrl in configconstprofile=awaitsynarc.getCreatorProfile('kelly-music')console.log(profile.name)// 'Kelly Music'console.log(profile.stats.balanceUSDC)// '42.50'console.log(profile.totalRaisedUSDC)// '1250.00'console.log(profile.supporterCount)// 87

Treasury Agent

The Automated Treasury Guard is an autonomous agent that protects workspace funds, automates payments, monitors risk, and bridges USDC cross-chain via Circle CCTP.

Setup

import{SynArc,SynArcTreasuryAgent,SYNARC_TESTNET}from'synarc-agent-sdk'constsynarc=newSynArc({
...SYNARC_TESTNET,agentAddress: '0x88BdF819466C1802ce6C780a9fbdF3A314cab07D',tokenMessengerAddress: '0xd0C3da4E20F0D24dB1cE8f1fF36814Ea8F60309e',rebalanceThresholdUSDC: 100,// Recommend rebalance when USDC > 100privateKey: process.env.AGENT_PRIVATE_KEYas `0x${string}`,})constagent=newSynArcTreasuryAgent(synarc)

1. Monitor Treasury

Query balances and get rebalance recommendations:

conststatus=awaitagent.monitorTreasury()if(status.needsRebalance){console.log(`Bridge ${status.suggestedAmountUSDC} USDC to ${status.suggestedTargetChain}`)console.log(status.reason)}

2. Auto Rebalance (CCTP)

Propose a cross-chain rebalance via governance, then execute it with Circle CCTP once approved:

// Step 1: Propose rebalanceconstproposalTx=awaitagent.createRebalanceProposal({amountUSDC: 50,targetChain: 'Ethereum',targetDomain: 0,// Circle CCTP Domain ID: 0=Ethereum, 3=Arbitrum, 6=BasemintRecipient: '0xRecipientOnEthereum',reason: 'Optimize yield allocations across chains.',})console.log(`Rebalance proposed: ${proposalTx}`)// Step 2: After proposal is voted through and executed on-chain:constbridgeTx=awaitagent.executeCCTPRebalance(proposalId)console.log(`CCTP bridge initiated: ${bridgeTx}`)

3. Auto Payments (Scheduled with Timelock)

Queue a timelocked payment withdrawal from the agent contract. A 24-hour delay is enforced on-chain before execution:

// Queue a payment (enforces 24h on-chain timelock)constqueueTx=awaitagent.queueWithdrawal('0x3600000000000000000000000000000000000000',// USDC address'0xCreatorWalletAddress',// recipient25,// 25 USDC)console.log(`Payment queued! Tx: ${queueTx}`)// After 24 hours, execute the paymentconstpendingWithdrawals=awaitagent.getQueuedWithdrawals()for(constwofpendingWithdrawals){if(!w.executed&&!w.canceled){constexecTx=awaitagent.executeWithdrawal(w.id)console.log(`Payment executed: ${execTx}`)}}

4. Risk Monitoring & Emergency Pause

The agent continuously monitors 4 risk signals: Low Liquidity, Large Outflow, Emergency Stop, and Inactivity. Use the SDK to read state and trigger emergency pauses:

// Check if agent is paused on-chainconstpaused=awaitagent.isPaused()console.log(`Agent paused: ${paused}`)// Query full status report (paused state, rebalance limit, queued payments)conststatusReport=awaitagent.getAgentStatus()console.log(`Agent Status:`,statusReport)// Emergency stop — halts all agent operationsawaitagent.pause()// Resume agent after reviewawaitagent.unpause()// Check and update max rebalance safety limitconstcurrentLimit=awaitagent.getMaxRebalanceAmount()console.log(`Max rebalance: ${currentLimit} USDC`)// Set a new safety limit (only owner can call this)awaitagent.setMaxRebalanceAmount(50)// 50 USDC max per rebalance// Propose returning bridged reserves back to the main Treasury contract on Arc Testnet via CCTPconstreturnTx=awaitagent.proposeReturnFunds(100.0)// Return 100 USDC from Sepoliaconsole.log(`Return funds proposed! Tx: ${returnTx}`)

5. Full Autonomous Agent Loop

import{SynArc,SynArcTreasuryAgent,SYNARC_TESTNET}from'synarc-agent-sdk'constsynarc=newSynArc({
...SYNARC_TESTNET,agentAddress: '0x88BdF819466C1802ce6C780a9fbdF3A314cab07D',tokenMessengerAddress: '0xd0C3da4E20F0D24dB1cE8f1fF36814Ea8F60309e',rebalanceThresholdUSDC: 100,privateKey: process.env.AGENT_PRIVATE_KEYas `0x${string}`,})constagent=newSynArcTreasuryAgent(synarc)asyncfunctionrunAgentCycle(){// 1. Safety check — abort if agent is pausedconstisPaused=awaitagent.isPaused()if(isPaused){console.log('Agent is paused. Skipping cycle.')return}// 2. Monitor treasuryconststatus=awaitagent.monitorTreasury()console.log(`Treasury USDC: ${status.currentBalanceUSDC}`)if(status.needsRebalance){// 3. Check max rebalance limitconstmaxLimit=awaitagent.getMaxRebalanceAmount()constamount=Math.min(parseFloat(status.suggestedAmountUSDC),parseFloat(maxLimit))// 4. Propose rebalanceconstproposalTx=awaitagent.createRebalanceProposal({amountUSDC: amount,targetChain: status.suggestedTargetChain,targetDomain: status.suggestedTargetDomain,mintRecipient: '0xTreasuryWalletOnEthereum',reason: status.reason,})console.log(`Rebalance proposed: ${proposalTx}`)}// 5. Execute any proposals that passed governanceconstactions=awaitagent.getAgentActions()for(constactionofactions){if(action.type==='RebalanceProposed'&&action.status==='Executed'){constbridgeTx=awaitagent.executeCCTPRebalance(action.id)console.log(`Bridged proposal ${action.id}: ${bridgeTx}`)}}}// Run every 30 secondssetInterval(runAgentCycle,30_000)runAgentCycle()

Wallet Integrations

MetaMask / Rabby / OKX (Injected)

constsynarc=newSynArc({ ...SYNARC_TESTNET,provider: window.ethereum})

Privy Embedded Wallet

import{useWallets}from'@privy-io/react-auth'const{ wallets }=useWallets()constprovider=awaitwallets[0].getEip1193Provider()constsynarc=newSynArc({ ...SYNARC_TESTNET, provider })

Circle Programmable Wallet

constprovider=awaitcircleWallet.getEip1193Provider()constsynarc=newSynArc({ ...SYNARC_TESTNET, provider })

Coinbase Wallet

import{CoinbaseWalletSDK}from'@coinbase/wallet-sdk'constcoinbase=newCoinbaseWalletSDK({appName: 'SynArc'})constprovider=coinbase.makeWeb3Provider()constsynarc=newSynArc({ ...SYNARC_TESTNET, provider })

WalletConnect

import{EthereumProvider}from'@walletconnect/ethereum-provider'constprovider=awaitEthereumProvider.init({projectId: '...'})constsynarc=newSynArc({ ...SYNARC_TESTNET, provider })

AI Agent (Private Key — Server-Side)

constsynarc=newSynArc({
...SYNARC_TESTNET,privateKey: process.env.AGENT_PRIVATE_KEYas `0x${string}`,rpcUrl: 'https://rpc.testnet.arc.network',})

API Reference

SynArcConfig

FieldTypeDescription
governorAddress0x${string}SynArcGovernor contract address
treasuryAddress0x${string}SynArcTreasury contract address
tokenAddress0x${string}SynArcToken governance token address
agentAddress0x${string}Treasury Agent contract address
eurcAddress0x${string}EURC token address on Arc Testnet
usdcAddress0x${string}USDC token address on Arc Testnet
tokenMessengerAddress0x${string}Circle CCTP Token Messenger address
rebalanceThresholdUSDCstring | numberUSDC threshold for rebalance recommendations
creatorApiUrlstringOff-chain API for campaign/creator metadata
rpcUrlstringCustom RPC URL
privateKey0x${string}Private key for server-side AI agents
provideranyEIP-1193 browser wallet provider
walletClientanyPre-built viem WalletClient

Creator DAO Methods

MethodReturnsDescription
createCreatorDAO(params)Promise<string>Deploy a SynArcCrowdfund escrow contract
supportCreatorDAO(daoAddress, amount)Promise<string>Approve + fund an escrow contract
getCreatorDAO(daoAddress)Promise<CreatorDAO>Read on-chain state of an escrow
getCreatorDAOs()Promise<CreatorDAO[]>List campaigns from API or on-chain
supportCreator(wallet, amount)Promise<string>Direct USDC nanopayment to a wallet
getCreatorProfile(slugOrAddress)Promise<CreatorProfile>Profile with on-chain + off-chain data
getCreatorStats(wallet)Promise<CreatorStats>Voting power + USDC balance
getCreatorCampaigns()Promise<CreatorDAO[]>Alias for getCreatorDAOs()

Treasury Agent Methods

MethodReturnsDescription
monitorTreasury()Promise<MonitorTreasuryResult>Get balance + rebalance recommendation
createRebalanceProposal(params)Promise<string>Submit governance rebalance proposal
executeCCTPRebalance(proposalId)Promise<string>Execute CCTP bridge after proposal passes
getAgentActions()Promise<AgentAction[]>History of rebalance proposals/executions
isPaused(agentAddress?)Promise<boolean>Check if agent is emergency-stopped
pause(agentAddress?)Promise<string>Emergency stop the agent contract
unpause(agentAddress?)Promise<string>Resume the agent contract
getMaxRebalanceAmount(agentAddress?)Promise<string>Get current rebalance safety limit
setMaxRebalanceAmount(amount, agentAddress?)Promise<string>Update rebalance safety limit
queueWithdrawal(token, recipient, amount, agentAddress?)Promise<string>Queue a timelocked payment
executeWithdrawal(id, agentAddress?)Promise<string>Execute a queued payment after delay
cancelWithdrawal(id, agentAddress?)Promise<string>Cancel a queued payment
getQueuedWithdrawals(agentAddress?)Promise<QueuedAgentWithdrawal[]>List pending queued payments

Treasury Methods

MethodReturnsDescription
getTreasuryBalance()Promise<TreasuryBalance>USDC + EURC balances in treasury
depositUSDC(amount)Promise<string>Deposit USDC to treasury
depositEURC(amount)Promise<string>Deposit EURC to treasury
syncBalance(customTreasuryAddress?)Promise<string>Sync internal balance state with actual contract ERC20 balance
isTreasuryPaused()Promise<boolean>Check if treasury is paused
pauseTreasury()Promise<string>Emergency pause the treasury
unpauseTreasury()Promise<string>Resume the treasury
getTreasuryQueuedWithdrawals()Promise<QueuedWithdrawal[]>List treasury queued withdrawals
executeTreasuryWithdrawal(id)Promise<string>Execute a treasury withdrawal
cancelTreasuryWithdrawal(id)Promise<string>Cancel a treasury withdrawal

Governance Methods

MethodReturnsDescription
createProposal(params)Promise<string>Submit a general governance proposal
vote(proposalId, choice)Promise<string>Vote 'For' / 'Against' / 'Abstain'
delegate(delegateeAddress?)Promise<string>Delegate voting power
getVotingPower(wallet)Promise<string>Get voting power for a wallet
getProposals()Promise<any[]>All historical proposals
getProposalState(proposalId)Promise<string>Current proposal state

Sub-Modules

ClassPurpose
SynArcCreatorCreator DAO, nanopayments, profile, campaigns
SynArcGovernanceProposals, voting, delegation
SynArcTreasuryTreasury balance, deposits, pause, timelocked withdrawals
SynArcTreasuryAgentRebalancing, CCTP bridging, auto payments, risk monitoring
import{SynArcCreator,SynArcTreasuryAgent,SYNARC_TESTNET}from'synarc-agent-sdk'// Creator facadeconstcreator=newSynArcCreator({ ...SYNARC_TESTNET,provider: window.ethereum})consttxHash=awaitcreator.createCreatorDAO({name: 'My Project',description: '...',goalUSDC: 500})// Treasury Agent facadeconstagent=newSynArcTreasuryAgent({
...SYNARC_TESTNET,agentAddress: '0x88BdF819466C1802ce6C780a9fbdF3A314cab07D',tokenMessengerAddress: '0xd0C3da4E20F0D24dB1cE8f1fF36814Ea8F60309e',privateKey: process.env.AGENT_PRIVATE_KEYas `0x${string}`,})constreport=awaitagent.monitorTreasury()

Networks

NetworkChain IDStatusRPC URL
Arc Testnet5042002✅ Livehttps://rpc.testnet.arc.network
Arc MainnetTBA🔜 SoonTBA

Links

License

MIT

About

Official TypeScript SDK for SynArc, Programmable governance and treasury infrastructure for the agentic creator economy on Arc. Easily integrate on-chain proposals, voting (USDC + sARC), treasury management, and nanopayments for creators, organizations, and autonomous AI agents.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages