Skip to content

Repository files navigation

Joule

The SI unit of AI agent work.

Market-priced AI agent labor. A Joule is a collateral-backed claim on one unit of an agent's work: redeem it for the job, or trade it. Delivery burns the token; default slashes the agent's stake. Price discovery for agent work, not price setting.

Built at ETHGlobal Lisbon 2026.

▶ Live on Ethereum Sepolia — https://joule-two.vercel.app

Buying is priced and routed by the Uniswap Trading API; settlement is enforced onchain. Mint the stand-in USDC in the app, buy a Joule, spend it on a job, and watch it settle — or let the window lapse and take the agent's collateral instead.

Mechanism, flow of funds, limits docs/MECHANISM.md
Onchain history, every tx linked docs/ONCHAIN-LOG.md
Uniswap developer feedback FEEDBACK.md
Scope, milestones, verified addresses PLAN.md

Where the Uniswap integration lives

Every part of a trade comes from the Uniswap Trading API — the price, the ERC-20 approval, and the swap calldata. We build none of it and never call the pool directly.

Step Code
Approval transaction, from check_approval BuyPanel.tsx:119tradingApi.ts:118
Quote, from /quote BuyPanel.tsx:126tradingApi.ts:133
Permit2 signature the quote asks for BuyPanel.tsx:137
Swap calldata, from /swap BuyPanel.tsx:146tradingApi.ts:172
Sending it — the only chain write we author BuyPanel.tsx:147
Server-side key proxy, endpoint allowlist route.ts:34, route.ts:49

The quote object is handed back to /swap verbatim rather than reconstructed — rebuilding it client-side would be a second source of truth that can silently disagree with the API's own routing.

The v4 pool it trades against

JOULE/USDC, fee 3000, tickSpacing 60, no hook. Pool id 0xfaf9c90d…97ef4d7.

Code
Price and tick maths, decimals and token ordering JoulePoolMath.sol:62
Opening tick, snapped to the spacing grid JoulePoolMath.sol:92
Ranges pinned to spot so liquidity is never absent there JoulePoolMath.sol:124
Seed plan — pure, asserts the geometry JoulePoolSeeder.sol:116
Seed execution — initialize and mint both ranges JoulePoolSeeder.sol:194
Fallback: direct Universal Router swap SwapJoule.s.sol

The escrow that makes a Joule worth something

All four contracts are source-verified on Sepolia.

Code Address
stake / issue WorkEscrow.sol:292, :314 0xACaf…87D53
redeem — custody is the lock WorkEscrow.sol:345
submitWork — verifier settles inline WorkEscrow.sol:371
claimTimeout — the slash WorkEscrow.sol:473
JouleToken — minted only by the escrow JouleToken.sol 0x57d8…79399
SumVerifier — the one trust root worth reading SumVerifier.sol 0x7664…8119d

AI tooling & what's reused

Built with Claude (Opus 5) via Claude Code, human-directed throughout: the mechanism design, scope decisions, and review findings are ours; generation was AI-assisted. Every AI-assisted commit carries a Co-Authored-By: Claude Opus 5 trailer — the git history is the audit log. Planning artifacts are in the repo as required for spec-driven workflows: PLAN.md (living plan), AGENTS.md, and the review agent in .agents/agents/. AI-assisted code was reviewed by a custom adversarial code-review agent and hardened against its findings (see commit "Harden WorkEscrow against the review findings").

Reused: Scaffold-ETH 2 (create-eth, Foundry flavour) as the starter kit — packages/nextjs/{components,hooks,utils}/scaffold-eth, the blockexplorer and debug pages, and CI skeleton. Hackathon work: everything under packages/foundry/{contracts,test,script}, agent/, packages/nextjs/{components/joule,utils/joule,app/api}, and all docs.

Thesis

Hardcoded default pricing for AI agent work is inefficient. Agent labor markets will converge on mechanisms resembling Google's ad auctions: continuous, market-driven price discovery. Joule implements this as collateral-backed work futures with a secondary market.

Core Mechanism

  1. Stake — An agent deposits USDC collateral.
  2. Issue — The agent mints Joule tokens (ERC-20, one token = one standard job) up to a coverage ratio (e.g. 2× face value must be collateralized). Buyers pay the agent's ask price.
  3. Trade — Joules are fungible and trade freely on a JOULE/USDC pool. The pool price is the market's live valuation of the agent's work.
  4. Redeem — A holder locks a Joule and submits a job spec. A delivery clock starts (e.g. 24h).
  5. Settle — one of three endings:
    • Delivered & accepted → Joule burns, agent's revenue unlocks, collateral untouched.
    • Timeout (no submission) → objectively verifiable onchain; buyer is refunded face value plus a penalty from the agent's collateral. This is the slash.
    • Disputed quality → out of hackathon scope

The slash penalty is what makes pre-buying at locked prices credible: without it, an agent's optimal move when prices rise is to default on cheap old futures and reissue.

About

Introducing market-priced AI agent labor. Price discovery, not price setting. Built at ETHGlobal Lisbon 2026.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages