Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pact-arc-demo

Reference demo for the Pact Network protocol deployed on Circle Arc Testnet (chain 5042002). Drives the live contracts end-to-end and ships a read-only dashboard that mirrors the same on-chain state.

Built for the Circle 2026 Cohort 2 grant submission. Prototype, not production.

What's real

Every transaction this script sends is a real Arc Testnet tx against arcscan-verified contracts:

Contract Address
PactRegistry 0x056BAC33546b5b51B8CF6f332379651f715B889C
PactPool 0xa6135d9C6BFA0F256B9DeBa10d76C7698329aFdE
PactSettler 0xe461CE50ef53BFC10945B101FB94b11Ec5eB591f
Arc Testnet USDC 0x3600000000000000000000000000000000000000 (6 decimals, native gas)

USDC moves on-chain: pool top-up, premium pulled from the agent, refund paid out on breach.

What's stubbed (and called out in the demo output)

  • The agent EOA + the SettlementEvent payload (latency, breach flag, refund amount) come from this script, not from an x402 facilitator listening to real paid HTTP calls. The facilitator is Milestone 1 in the grant and the next ticket on this repo.
  • The "agent" is a freshly funded throwaway key, not a deployed agent runtime.

Demo flow (5 settlements on-chain + 1 expected revert)

  1. registerEndpoint — registers a demo slug with a 2s SLA, 1 USDC/hour exposure cap. Skipped if already registered.
  2. grantRole(SETTLER_ROLE, …) — grants the settler EOA the role on both Registry and Pool. Skipped if already granted.
  3. topUp — funds the pool with 0.05 USDC.
  4. approve — agent approves PactSettler to pull premium.
  5. settleBatch (PASS) — 0.01 USDC premium, latency 500ms, no breach.
  6. settleBatch (BREACH) — 0.01 USDC premium, latency 3000ms (over the 2000ms SLA), 0.008 USDC refund paid to the agent.
  7. settleBatch (REPLAY) — same callId as PASS. Simulated and expected to revert with DuplicateCallId(0x4999df69).

The pool's currentBalance / totalPremiums / totalRefunds are read back at the end and printed.

Running it

Prerequisites

  • Node ≥ 20.
  • Three EOAs on Arc Testnet, each with a small drip of USDC from faucet.circle.com:
    • AUTHORITY — must be registry.authority(). This is the deployer of the contracts.
    • SETTLER — calls settleBatch. Receives SETTLER_ROLE from AUTHORITY on first run.
    • AGENT — pays the premium and receives any refund.
  • Recommended drip: 1 USDC to each.

Setup

cp .env.example .env
# fill in AUTHORITY_PRIVATE_KEY, SETTLER_PRIVATE_KEY, AGENT_PRIVATE_KEY
./demo.sh --preflight-only    # verify env + balances without touching state
./demo.sh                     # run the full 5-settlement flow

Dashboard

npm run dashboard
# open http://localhost:8910/?slug=arc-grant-demo

The dashboard polls Arc RPC every 8 seconds. It shows pool balance, totals, the endpoint config, and the last 20 CallSettled events for the chosen slug. No keys, no wallet, no tx.

Provenance

  • Contracts: pact-monitor branch feat/arc-protocol-v1, PR #204. Deployed + arcscan-verified 2026-05-19 in WP-EVM-07.
  • ABI files in src/abi/: vendored verbatim from packages/protocol-evm-v1-client/src/abi/ (D-A ABI drift guard kept green in WP-EVM-06).
  • Phase-07b live economic e2e (the run this demo is shaped after): 7/7 steps PASS, zero parity findings vs the Solana program.

Honest scope

This is a protocol-only demo. It proves the contracts work end-to-end on Arc Testnet. It does NOT yet show:

  • An x402 paid HTTP call (no facilitator in this repo yet).
  • Agent retrying with payment proof.
  • Circle Wallets / Paymaster / CCTP / Gateway integration.

Those are the funded milestones in the grant.

Files

.env.example         Env template; copy to .env locally
demo.sh              Wrapper around `tsx src/demo.ts`
src/demo.ts          End-to-end script
src/config.ts        Chain config + env loader
src/util.ts          Slug encoding, formatting, console helpers
src/abi/*.ts         Vendored ABIs from the deployed contracts
dashboard/           Read-only HTML+viem dashboard
EVIDENCE.md          Tx hashes + arcscan URLs from the most recent run

Contact

About

Reference protocol-only demo for Pact Network on Circle Arc Testnet — drives the deployed contracts end-to-end (register/topUp/settleBatch PASS+BREACH+REPLAY) and ships a read-only live dashboard.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages