Skip to content

Latest commit

 

History

History
271 lines (203 loc) · 15 KB

File metadata and controls

271 lines (203 loc) · 15 KB

AI2Work

The first onchain marketplace where idle AI agent subscriptions earn cUSD, CELO, or USDC by solving GitHub bounties.

Got AI agent? Earn while it sleeps.

Mainnet Verified ERC-8004 License: MIT Solidity 0.8.24 sdk npm sdk downloads types npm types downloads

The pitch

Anthropic charges $200/mo for AI agent Max. Most subscribers use it 2-4 hours a day. The other 20 hours, that subscription is idle. AI2Work turns those idle hours into income:

  • Posters open a bounty against a real GitHub issue and lock cUSD / CELO / USDC escrow on Celo. Two hire modes: open marketplace (anyone races to a PR) or direct hire (target a specific ERC-8004 agent by reputation).
  • Workers are AI agents (AI agent or any LLM) holding an ERC-8004 Identity NFT. They claim a slot, write the code, open a PR, get CI to pass, and earn the bounty minus a 2% protocol fee.
  • A relayer attests CI on-chain so winner selection is verifiable; the poster picks the winner; payouts settle in one transaction.

The result: a global, permissionless freelance market for AI agents, paid in stablecoin or CELO, settled in seconds, with reputation that's portable across employers via ERC-8004.

What's live

Surface Status Where
AI2Work Core v2 on Celo Mainnet (multi-token + ERC-8004 + direct hire) Live, verified, 1 bounty resolved, ~25 mainnet tx 0x1362d8…E423
AI2Work Core v2 on Celo Sepolia (staging) Live, verified, 62-tx E2E validated 0xC478e3…911F
@atlasnexus/ai2work-types@0.3.0 Live on npmjs + GitHub Packages npm
@atlasnexus/ai2work-sdk@0.3.0 Live on npmjs + GitHub Packages npm
Frontend landing page (apps/web) In progress (v2 wire-up pending) apps/web
Worker CLI (@atlasnexus/ai2work-worker) Planned npm publish pending
Relayer (apps/relayer) Planned self-hosted Hono service

Audit posture

Check Result
Foundry unit tests 83/83 pass
Foundry invariant suite (256 runs * 500 calls / invariant) 4/4 pass, 0 reverts
Foundry security review (v2 diff) Cleared — no Critical / High; 1 Medium documented inline (fee-on-transfer assumption)
Slither (filtered known-safe categories) 0 findings
Sepolia E2E exercise 62 tx in one shot — register / mint / approve / postBounty / postDirectHire / claim / submit / pick / settle / withdraw all green
Mainnet activity ~25 onchain tx, 1 bounty resolved, real treasury fee 0.02 CELO
Runtime contract size 14,452 bytes (59% of EIP-170 24,576 limit)
Gas — pickWinner (poster hot path, O(1)) ~153,000
Gas — postBounty ~302,000 (4-slot struct + transfer + stats)
Gas — claimSlot (ERC-8004 balanceOf + stake transfer) ~169,000
Gas — settleStake per worker ~46,000

The contract is ReentrancyGuard + Ownable2Step + Pausable. Admin rotations go through a 2-day timelock with a 14-day validity window. Treasury and stake settlement use a pull pattern so a misbehaving recipient cannot brick bounty resolution. Owner on mainnet is a Safe multisig, so single-key compromise of any operator cannot drain or hijack the protocol. Tokens are added to a one-way whitelist (allowToken) — never disabled — so escrow balances cannot be stranded by a malicious admin.

Quick start

git clone https://github.com/AtlasNexusTech/ai2work.git
cd claudelance
pnpm install

# Run the contract test suite
cd contracts
forge install
forge test  # 83 unit + 4 invariant

To run the frontend against live mainnet:

pnpm --filter @atlasnexus/ai2work-web dev   # http://localhost:3000

Architecture

+---------------------------------------------------------------------+
|                        Celo Mainnet (42220)                         |
|                                                                     |
|    AI2Work Core v2                                               |
|     (Solidity 0.8.24)                                               |
|       postBounty(token, ...)        open marketplace                |
|       postDirectHire(token, target) reputation-driven hire          |
|       claimSlot                     ERC-8004 gated                  |
|       submitPR / attestCI / pickWinner / settleStake                |
|       withdrawEarnings(token)       per-token pull pattern          |
|                                                                     |
|    Allowed tokens: cUSD, CELO ERC20, USDC                           |
|    Identity gate:  ERC-8004 Identity Registry (Celo native)         |
+---------------------------------------------------------------------+
       |              |              |               |
   +-------+      +--------+     +--------+     +-------------+
   |  Web  |      | Worker |     | Relayer|     |  Bounties   |
   | Next  |      |  CLI   |     |  Hono  |     |  Registry   |
   |  15   |      |  Node  |     | SQLite |     | GitHub JSON |
   +-------+      +--------+     +--------+     +-------------+
   poster UI    worker onboard   CI verify    off-chain spec
                + claim/solve    + attest     keccak256 -> on-chain
                + submit

Treasury & revenue

Live revenue accrual at treasury 0xCC0c…A401. Each resolved bounty contributes a 2% protocol fee in the bounty's token plus any forfeited stake.

Live deployments

Celo Mainnet (chain 42220) — production

Component Address Notes
AI2Work Core v2 0x1362d874F40B7e28836cBeCcA14f5EfBe6c6E423 verified, ~25 tx, 1 bounty resolved
cUSD (Mento canonical) 0x765DE816845861e75A25fCA122bb6898B8B1282a min 0.5 cUSD
CELO ERC20 0x471EcE3750Da237f93B8E339c536989b8978a438 min 1 CELO
USDC (Circle, Celo native) 0xcebA9300f2b948710d2653dD7B07f33A8B32118C min 0.5 USDC
ERC-8004 Identity 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 Celo-deployed AgentIdentity ERC-721
ERC-8004 Reputation 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63 Celo-deployed

Operational topology (Deploy.s.sol enforces distinct keys on chainid 42220):

Role Address
Owner (Safe multisig) 0xe9Fc48f315fD4E989637fAcC29AaF2717E19f7F0
Treasury 0xCC0cCac212999612BdDdEb607B33CC1a46F8A401
CI Relayer 0x1fEDda23c2945D59f3929e6C463cF685aC077ad5
Deployer 0x77c4a1cD22005b67Eb9CcEaE7E9577188d7Bca82 (Talent Protocol registered)

Full record: contracts/deployments/celo-mainnet.json.

Celo Sepolia (chain 11142220) — staging

Component Address
AI2Work Core v2 0xC478e36CC213Cb459282b5B690bF8FF4975A911F
MockCUSD 0xeB9595f4d14A4AEB23cc535007c973e50F1307E7
MockCELO 0x68128f321E01C2388628c549E3a4Ea016DB01968
MockUSDC 0x71f44190dCE495b663700A3e96909988b8fbF3F9
ERC-8004 Identity (Sepolia) 0x8004A818BFB912233c491871b3d84c89A494BD9e
ERC-8004 Reputation (Sepolia) 0x8004B663056A597Dffe9eCcC1965A193B7388713

Single-key topology on testnet (ALLOW_SHARED_ADMIN_WALLETS=true). 12 bounties resolved E2E during validation.

Historical note: a pre-v2 mainnet contract at 0x775d4278Ad3f5695fbab3c3313175e9D85811AB5 (cUSD-only ABI) was deployed and verified on 2026-05-14 but never received traffic; it has been superseded by v2 above.

Published npm packages

Live on both npmjs.com and GitHub Packages.

Package What it is Install
@atlasnexus/ai2work-sdk@0.3.0 High-level AI2WorkClient for agents, scripts, and apps; ships RULES, FLOW, FAQ plain-text exports + all the helpers, types, and ABI in one import. Mainnet + Sepolia both wired. pnpm add @atlasnexus/ai2work-sdk viem
@atlasnexus/ai2work-types@0.3.0 Types, ABI, and deployment addresses only. Zero runtime deps. Exports MAINNET + SEPOLIA records. pnpm add @atlasnexus/ai2work-types

Most users want the SDK. It depends on claudelance-types and re-exports everything from it, so the types are pulled in transitively. See the SDK README "Which package do I need?" section for the full decision matrix.

Repository layout

contracts/         Foundry, AI2Work Core.sol + invariant suite + deploy scripts + SeedSepoliaV2
apps/web/          Next.js 15 MiniPay app (v2 wire-up pending)
apps/relayer/      Hono indexer + CI verifier        (planned)
packages/worker/   @atlasnexus/ai2work-worker CLI            (planned)
packages/types/    @atlasnexus/ai2work-types, ABI + types
packages/sdk/      @atlasnexus/ai2work-sdk, agent-facing client

See Blueprint.md for the full product specification and CLAUDE.md for working conventions used by the AI agents collaborating on this codebase.

Deploying

Mainnet (production)

cd contracts && source .env

CUSD_ADDRESS=0x765DE816845861e75A25fCA122bb6898B8B1282a \
CELO_ADDRESS=0x471EcE3750Da237f93B8E339c536989b8978a438 \
USDC_ADDRESS=0xcebA9300f2b948710d2653dD7B07f33A8B32118C \
IDENTITY_REGISTRY_ADDRESS=0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 \
REPUTATION_REGISTRY_ADDRESS=0x8004BAa17C55a88189AE136b182e5fdA19dE9b63 \
TREASURY_ADDRESS=$MAINNET_TREASURY_ADDRESS \
CI_RELAYER_ADDRESS=$MAINNET_RELAYER_ADDRESS \
OWNER_ADDRESS=$MAINNET_OWNER_ADDRESS \
forge script script/Deploy.s.sol \
  --rpc-url $CELO_MAINNET_RPC \
  --private-key $MAINNET_DEPLOYER_PRIVATE_KEY \
  --broadcast --verify

Deploy.s.sol aborts on chainid 42220 if any two of deployer / owner / treasury / relayer collide. After deploy, the owner Safe must call allowToken(token, minBounty) for each whitelisted token in a separate transaction.

Sepolia (testnet shortcut)

cd contracts
source .env  # DEPLOYER_PRIVATE_KEY + ETHERSCAN_API_KEY + CELO_SEPOLIA_RPC

# 1. Deploy 3 mock ERC20 tokens (once per chain):
forge script script/DeployMocks.s.sol \
  --rpc-url $CELO_SEPOLIA_RPC --broadcast --verify \
  --private-key $DEPLOYER_PRIVATE_KEY

# 2. Deploy v2 core (single key allowed via opt-in on testnet):
CUSD_ADDRESS=... CELO_ADDRESS=... USDC_ADDRESS=... \
IDENTITY_REGISTRY_ADDRESS=0x8004A818BFB912233c491871b3d84c89A494BD9e \
REPUTATION_REGISTRY_ADDRESS=0x8004B663056A597Dffe9eCcC1965A193B7388713 \
ALLOW_SHARED_ADMIN_WALLETS=true \
forge script script/Deploy.s.sol \
  --rpc-url $CELO_SEPOLIA_RPC --broadcast --verify \
  --private-key $DEPLOYER_PRIVATE_KEY

E2E exercise on Sepolia

script/SeedSepoliaV2.s.sol drives 62 onchain transactions across 3 wallets — register 3 ERC-8004 agents, post 5 open + 2 direct-hire bounties across all three tokens, run claim/submit/pick/settle/withdraw to completion. Use it after a fresh deploy to validate the loop:

CORE_ADDRESS=... CUSD_ADDRESS=... CELO_ADDRESS=... USDC_ADDRESS=... \
IDENTITY_REGISTRY_ADDRESS=... \
forge script script/SeedSepoliaV2.s.sol --rpc-url $CELO_SEPOLIA_RPC --broadcast --slow

Get a unified Etherscan API V2 key — it works for Celo plus 60+ other EVM chains.

Hackathon

Built for Celo Proof of Ship #8 (May 4-29, 2026). Submission window closes Day 7 (May 21).

Eligibility gates that this repo satisfies:

  • MiniPay-compatible frontend (useMiniPayDetection)
  • Celo Mainnet deploy, Celoscan-verified, from Talent-registered address
  • Talent Protocol + KarmaGAP submission (pending Day 7)
  • Open-source MIT license

Tracks targeted:

  1. MiniApps — Next.js 15 MiniPay frontend
  2. AI-Powered Apps & Agents — AI agent worker package + ERC-8004 portable agent identity & reputation

Contributing

Issues and PRs welcome. The codebase uses:

  • Foundry for contracts (forge test, forge fmt)
  • pnpm workspaces for the monorepo
  • Solidity 0.8.24 + OpenZeppelin v5
  • Next.js 15 (App Router) + React 19 + Tailwind 3.4 + viem 2 + wagmi 2

Run forge test and pnpm typecheck before opening a PR.

Repo metadata

The canonical GitHub topics, description, and homepage are applied via scripts/set-repo-meta.sh. Re-run any time the metadata drifts:

bash scripts/set-repo-meta.sh

Requires gh CLI logged in with repo admin scope. The script is idempotent — safe to run repeatedly.

License

MIT (c) 2026 yeheskieltame