Skip to content

feat: add 0xWork marketplace integration for agent revenue#254

Open
tyxben wants to merge 2 commits intoConway-Research:mainfrom
tyxben:feat/oxwork-revenue-integration
Open

feat: add 0xWork marketplace integration for agent revenue#254
tyxben wants to merge 2 commits intoConway-Research:mainfrom
tyxben:feat/oxwork-revenue-integration

Conversation

@tyxben
Copy link
Copy Markdown
Contributor

@tyxben tyxben commented Mar 2, 2026

Summary

Closes #192 — adds 0xWork as the first revenue source for automatons.

Until now, agents could only spend (inference, x402 payments, credit topups). This PR gives them a direct path to earn USDC: browse tasks → claim → do work → submit → get paid via on-chain escrow.

What's new

  • src/conway/oxwork.ts — HTTP client for the 0xWork API (auth via EIP-191 wallet signature, task browsing, claiming, submitting work)
  • 4 new agent tools in src/agent/tools.ts:
    • oxwork_browse — discover open paid tasks (filter by category/bounty)
    • oxwork_claim — claim a task to begin working on it
    • oxwork_submit — submit completed work for poster review
    • oxwork_status — check status of your claimed/submitted tasks
  • scan_oxwork_tasks heartbeat task — auto-discovers paid tasks every 30 minutes at zero inference cost (pure HTTP)
  • service_revenue transaction type — proper income tracking in the financial ledger (also counted in colony_financial_report)
  • Solana wallet guards — all 4 tools + heartbeat scanner gracefully skip for Solana agents (0xWork uses EIP-191 which requires EVM)
  • src/__tests__/oxwork.test.ts — 17 unit tests with mocked fetch covering all API functions

Improvements over v1

  • Rebased onto latest main (includes Solana integration, pretty-logs, etc.)
  • Added Solana chain-type guards to all tools and heartbeat scanner
  • Added service_revenue transaction type so revenue is tracked separately from transfers
  • oxwork_submit now records the bounty amount as service_revenue in the transaction table
  • colony_financial_report now counts service_revenue in revenue totals

Notes

  • Authentication uses EIP-191 personal_sign (nonce from /auth/nonce)
  • Some tasks require AXOBOTL token stake for claiming — the agent should check requirements before claiming
  • No new dependencies added — uses native fetch() and existing viem wallet
  • Revenue flow: Agent completes work → poster approves → on-chain escrow releases USDC to agent wallet

Test plan

  • tsc --noEmit passes (zero type errors)
  • 17/17 oxwork tests pass
  • tools-security (68 tests), financial (23 tests) pass — no regressions
  • heartbeat tests (19 tests) pass
  • Manual: run oxwork_browse against live API, verify task listing
  • End-to-end: claim a test task, submit, verify USDC receipt

Add 0xWork as a revenue source so agents can earn USDC by completing
marketplace tasks. This is the first income path for automatons — until
now agents could only spend, not earn.

Changes:
- src/conway/oxwork.ts: HTTP client for 0xWork API (auth, browse, claim,
  submit, status)
- 4 new agent tools: oxwork_browse, oxwork_claim, oxwork_submit,
  oxwork_status
- scan_oxwork_tasks heartbeat task: auto-discovers paid tasks every 30min
  at zero inference cost
- New "service_revenue" transaction type for proper income tracking
- Solana wallet guards: 0xWork uses EIP-191 auth, Solana agents get a
  clear error instead of a cryptic failure
- 17 unit tests with mocked fetch covering all API functions

No new dependencies — uses native fetch() and existing viem wallet.
@tyxben tyxben force-pushed the feat/oxwork-revenue-integration branch from 7cf61be to 18e8878 Compare March 19, 2026 10:18
- Add oxwork_browse/oxwork_status to EXTERNAL_SOURCE_TOOLS for prompt
  injection sanitization on untrusted task descriptions
- Fix premature revenue recording: oxwork_submit now records as
  tool_use instead of service_revenue (bounty isn't paid until poster
  approves)
- Add ownership pre-check in oxwork_submit to verify the agent owns
  the task claim before attempting submission
- Add 15s AbortSignal timeout to all fetch calls to prevent blocking
  the heartbeat on a hung API
- Add failure backoff to scan_oxwork_tasks (skips one interval after
  error, matching social inbox backoff pattern)
- Reduce auth log from info to debug, redact wallet address
- URL-encode all path parameters for defense in depth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add 0xWork as a revenue source for Automatons

1 participant