Search projects, hackathons, sponsors and tech

    ← All projects

    Turing Swap

    An identity-aware DEX where humans trade cheaper, bots pay dynamically, and LPs earn smarter.

    Demo

    About

    Turing Autopilot Turing Autopilot lets a verified human describe a trading goal in plain English. A human-backed agent executes it as a limited, multi-step position on World Chain while the user keeps custody of their funds. It builds on TuringSwap, which won ETHGlobal Lisbon 2026’s World AgentKit “New Use Cases” prize. What I built at Lisbon TuringSwap gives verified humans a lower-fee trading lane. I added opcode 34, `_humanGate`, to 1inch SwapVM. It checks World’s canonical AgentBook to verify that a unique World ID human backs the wallet. Verified users get lower fees, while everyone else trades in a wider risk-priced lane. The cheap lane has a daily quota tied to the human, not the wallet, so creating more wallets doesn't help. LPs still target a 30 bps blended fee. What’s new: Autopilot At Lisbon, TuringSwap handled a single swap. Autopilot turns that into a strategy that runs over time. 1. Describe the goal — for example, “Buy tETH with 500 tUSD in 5 slices while searcher flow is low.” 2. Compile it safely — the text maps to a fixed DCA schema with hard limits. It cannot generate arbitrary code or calldata. 3. Verify the human — AgentBook must show a verified human before anything can execute. 4. Check live conditions — Nuthatch provides searcher flow, fees and execution-price spread. If the data isn't trustworthy or up to date, execution fails closed. 5. Keep the human in control — the user activates and can pause the strategy at any time. 6. Execute each slice — every transaction goes through the user's wallet, opcode 34 and 1inch Aqua. The user signs every slice; there are no server trading keys. 7. Verify the result — after each transaction, the system checks the actual receipt, events, calldata, amounts, fees and timing before updating the position. Where it runs Everything runs on World Chain mainnet: identity, execution, liquidity, test tokens, faucet and indexing. The stack is World ID + AgentBook, 1inch Aqua + SwapVM, The Graph Nuthatch, Solidity/Foundry, Hono/TypeScript and React/Vite. Why it matters Trading agents need two things most demos skip: Proof that a real human is behind the agent. Hard limits the agent cannot talk its way around. Autopilot combines World ID for human accountability, a fixed strategy schema for safety, Nuthatch for live evidence, and TuringSwap's verified-human fee lane for execution.

    How it's made

    STACK AT A GLANCE - Contracts: Solidity 0.8.30 and Foundry (via-IR), built on 1inch's SwapVM and Aqua libraries. - API: TypeScript on Hono and viem, using the official @worldcoin/agentkit SDK. - Frontend: React 19 and Vite, with raw EIP-1193 wallet calls (no wagmi) and IDKit for World ID. - Indexing: a self-hosted Nuthatch nest from The Graph, with custom SQL views, a semantic layer and MCP. - Workspace: a pnpm monorepo with contracts, server, web, agent, nuthatch, economics and scripts. - Chain: everything runs on World Chain mainnet (480). - Continuity: the ETHOnline work is the diff from the Lisbon baseline 6acd9b5 to 1dc5c02, which covers 84 files, +7,215 and −1,273 lines. ON-CHAIN LAYER 1. We redeployed a 1inch SwapVM router (1inch explicitly allows this) with the standard Aqua opcode table and one new instruction appended at the end: opcode 34, _humanGate. It takes 48 bytes of packed arguments: AgentBook address, quota controller address, and fallback wide and tight fees. It makes one staticcall to AgentBook.lookupHuman(taker) and checks that human's remaining daily quota in the token whose amount the taker fixed. The fee is applied continuation-style: it adjusts amountIn, runs the rest of the SwapVM program through ctx.runLoop(), then restores the amount. This mirrors 1inch's own flat-fee instruction. The same code runs for quotes (static context) and for swaps. It only writes quota usage and emits HumanGated during a real swap, so a quote always matches what the swap will execute. 2. HumanQuota.sol stores used[humanId][token][day] and runs the fee controller on-chain. After every fill it re-solves the two fees so that tightVolume × tightFee + wideVolume × wideFee = totalVolume × 30 bps. The tight fee is rounded first and the wide fee absorbs the integer remainder, so the blended fee stays exactly on target. There are separate cases for when all volume is in one lane. 3. LP vaults. Aqua strategies are immutable, so every deposit or withdrawal does the following in one transaction: dock the current order, revoke its quota authorization, move the tokens, build a new opcode-34 program with a fresh salt, authorize the new order hash, and ship the full inventory back to Aqua. Many vaults share one router, so we added version 2 of HumanGate. It binds each quota write to the executing orderHash, and without that, someone else's order on the shared router could corrupt a vault's fee state. A permissionless factory creates vaults, each with its own quota controller. An on-chain faucet hands out test tETH and tUSD every 24 hours. 4. Risk policy. A strategist agent can only nudge two parameters, the desired tight fee and the risk spread, through applyRiskPolicy. The contract requires the indexed block to be newer than the last one applied and within a maximum lag of the chain tip, limits each step to a maximum size, and requires a non-zero decisionHash. The agent computes that hash with keccak over the exact Nuthatch window it used, including the nest's registry hash. The result is then passed back through the same on-chain fee solver. INDEXING (The Graph Nuthatch) The nest follows three contracts on World Chain: the vault router (HumanGated, Swapped), the vault quota controller (UsageRecorded, FeeScheduleUpdated, RiskPolicyApplied) and the active vault (LiquidityAdded, LiquidityRemoved). The lane and the fill arrive as separate events, so a SQL view joins Swapped and HumanGated on tx_hash and orderHash. On top of that sit views for fee history, activity mix and a 50-fill risk window with tight/wide volume share, average fees per lane and average execution price per lane. The server and the strategist query these over Nuthatch's SQL endpoint, and the same data is exposed over MCP. TURING AUTOPILOT (the new ETHOnline layer) - Compiler: a deliberately deterministic parser, not an LLM. Regexes pull out amount, direction, slice count, searcher-share limit, fee limit and price-spread limit. Every value is clamped to a fixed conditional-DCA schema, and invalid directions, slice counts or zero-size slices throw errors. Each plan carries a sha256 decision hash over its parameters and the evidence it was evaluated against. - Evidence client: before trusting any row, the server validates Nuthatch's /ready response: ready, not stalled, lag within bounds, and the nest's registry hash. Then every SQL response's provenance must not be ahead of the final readiness snapshot and must match the nest's registry hash. Any failure sets evidence to unavailable, and the plan's decision becomes "wait". On World Chain there is deliberately no fallback to raw events. - Service: plans move through draft, active, paused and completed. All changes, including checking whether a receipt was already used by another plan, are serialized through a promise-chain mutex. Plans are persisted by writing a temp file and atomically renaming it. For each slice, the server reads the chain again, looks up the owner in AgentBook, requires every check to pass, simulates the SwapVM call, checks that the quote is in the right lane (tight for verified humans, wide otherwise) and within the fee limit, and records a preparation that expires after five minutes. - Receipt reconciliation: after the user's wallet broadcasts, the server checks the mined receipt's SwapVM, Aqua and HumanGated events for wallet, direction, exact amount, lane and fee. It also requires a block after the preparation block, calldata byte-for-byte equal to what was prepared, the same from and to addresses, and a timestamp inside the window. Replaying a hash in the same plan does nothing; replaying it in another plan is rejected. - Frontend: the Autopilot workspace shows the Agent Passport, each check's measured vs. allowed value with its Nuthatch block, a progress ring for slices and explorer links for every confirmed slice. The user approves each slice in their own wallet. HOW PARTNER TECH HELPED - World: AgentBook is a plain public mapping, so a smart contract can use it directly. That turns "is a unique human behind this wallet?" into one staticcall inside the swap, with no oracle and no per-trade ZK verification. The humanId nullifier is the same for every wallet a person registers, so a per-person quota takes about 20 lines of Solidity. AgentKit's 402, SIWE and verify flow protects the quote API. - 1inch: SwapVM made pricing by personhood an instruction instead of a new AMM. Aqua let LP inventory stay in vaults the owners control while trades settle directly between wallets. - The Graph: Nuthatch gave us correlated per-lane fills as SQL with provenance and registry hashes. That let both agents refuse to act on stale or mismatched data rather than trusting whatever an RPC returned. HACKY BITS WORTH MENTIONING - Adding one 48-byte-argument instruction pushed the forked router past EIP-170's 24,576-byte limit. We fixed it by dropping the Simulator mixin and re-tuning the optimizer. - The project started on a Base fork. For fork tests we worked out that AgentBook's lookupHuman mapping sits in storage slot 4 and checked it against the deployed bytecode. We later moved everything to World Chain so opcode 34 could read AgentBook in the same transaction, with no cross-chain relay. - AgentKit's validateAgentkitMessage expects the SIWE domain to be the hostname without the port, so "localhost:4021" fails. We also built the x402-style 402 challenge by hand, because we weren't running a full x402 server. - Public World Chain RPCs cap eth_getLogs ranges and rate-limit hard. We wrote a small JSON-RPC proxy that splits log queries into chunks, rotates across several upstreams, spaces out requests, backs off on 429s, and removes duplicate logs and re-sorts them. - The price of a quote depends on who the taker is, so RPC batching must never lose msg.sender. We have regression tests that prove sender-bound quotes survive viem's multicall batching. - pnpm demo:market starts a local-only Anvil market where two actors keep trading, with guards on loopback origin and chain ID. This lets us rehearse the full browser flow without spending mainnet gas. TESTING The suites cover 40 Foundry tests plus 57 server, 18 frontend, 8 agent and 9 economics tests. An isolated Anvil end-to-end run passes 16/16 assertions, including a mined multi-slice strategy, exact receipt matching, fake-hash rejection and idempotent replays. A read-only live check simulates quotes, approvals, liquidity and the faucet against the deployed mainnet contracts and live Nuthatch.