Skip to content

docs: add ERC-8183 job lifecycle example for Arc Testnet - #123

Open
consumeobeydie wants to merge 4 commits into
circlefin:mainfrom
consumeobeydie:docs/erc8183-job-lifecycle-example
Open

docs: add ERC-8183 job lifecycle example for Arc Testnet#123
consumeobeydie wants to merge 4 commits into
circlefin:mainfrom
consumeobeydie:docs/erc8183-job-lifecycle-example

Conversation

@consumeobeydie

Copy link
Copy Markdown

Summary

This PR adds a practical ERC-8183 agentic commerce job lifecycle example to the Arc Testnet documentation.

What's included

  • Complete ERC-8183 job lifecycle: createJob → setBudget → approve → fund → submit → complete
  • Circle Developer-Controlled Wallets integration
  • Live on-chain proof with all transaction hashes

Live Example

Tested and verified on Arc Testnet:

  • Job ID: 110860
  • Status: Completed
  • Budget: 5 USDC

Related PRs

This PR completes the agentic stack trilogy:

  • docs/foundry-smart-contract-deploy-guide (Solidity contracts)
  • docs/x402-arc-agent-example (X402 payments)
  • docs/erc8004-agent-registration-example (ERC-8004 identity)
  • docs/erc8183-job-lifecycle-example (ERC-8183 jobs) ← this PR

Full repository: https://github.com/consumeobeydie/arc-agent-api

@osr21

osr21 commented Jun 30, 2026

Copy link
Copy Markdown

Real-world ERC-8183 implementation report — Arc Stablecoin DApp

We built a full ERC-8183 Agentic Commerce implementation on Arc Testnet as part of the Arc Stablecoin DApp (live demo). Sharing our findings to complement this PR.


Deployed contract

AgenticCommerce at 0x0Ecdad8fdA2Dde60E475e70Ebf177F2299FECB48 — Arc Testnet (Chain 5042002).


Gas limits — Arc requires higher than standard EVM

The most important gotcha. Arc's opcode costs are higher than standard EVM. Default estimateGas values will revert silently:

Operation Required gas
createJob() 400,000 minimum
bid(), acceptBid(), submitDeliverable(), approveDeliverable(), cancelJob() 200,000 minimum

We hardcode these limits rather than relying on estimateGas for Arc. The on-chain cost of approveDeliverable (one SSTORE + one ERC-20 transfer) was 69,707 gas in practice, but estimation was unreliable.


Custom error selectors to decode in the frontend

Selector Error When it fires
0x82b42900 Unauthorized() Wrong role — client tried to bid on own job, or non-provider tried to submit deliverable
0x70f65caa DeadlinePassed() Job deadline expired — bidding / submission closed
0x0d2f0676 AlreadyBid() This address already has an active bid on the job
0xff97b861 ZeroBudget() Budget must be > 0 when creating a job

Decode pattern: take bytes [2..10] from the raw revert hex string (first 4 bytes after 0x).


Double Transfer event on Arc — don't double-count

When approveDeliverable() releases USDC from escrow, two Transfer events fire in the same tx:

  1. Arc native precompile mirror at 0xfffffffffffffffffffffffffffffffffffffffe
  2. USDC ERC-20 address 0x3600000000000000000000000000000000000000

Both represent the same single transfer. Filter by the ERC-20 address (0x3600...) when parsing receipts to avoid counting it twice.


On-chain proof — complete lifecycle

Successful approveDeliverable(jobId=3): 0x68fbe19d586bf43c29f003a85610650ea06270fb2b71ca04263bb150e8ce22e9

  • Gas used: 69,707 / 200,000
  • 3 logs: native precompile Transfer + ERC-20 Transfer + DeliverableApproved

UI role-enforcement patterns

Pre-emptive UI guards prevent most reverts before they reach the chain:

  • Hide bid() button when connectedWallet === job.client
  • Disable submitDeliverable unless connectedWallet === job.provider
  • Disable bid() when block.timestamp >= job.deadline
  • Disable approveDeliverable / cancelJob unless connectedWallet === job.client

@ZhiyuCircle ZhiyuCircle added documentation Improvements or additions to documentation ecosystem Component: ecosystem labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ecosystem Component: ecosystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants