Wick

An AI market maker on Base that pays for its own brain with the fees it earns

Wick

Created At

ETHGlobal Mumbai

Project Description

Most AI agents stop the day their owner stops paying the API bill. Wick is an AI agent that earns its own.

Wick runs a W0G/USDC market on Base. Every five minutes it asks its brain, a TEE-verified model on 0G Private Computer, for a spread, a size and a lifetime. Code centres both prices on the Uniswap v3 600 second TWAP and the agent signs them as one EIP-712 pair. The 0G request id, the provider and the TEE verdict are hashed into the price itself, so every fill on Base traces back to one sealed AI run.

The price is binding. Our own SwapVM instruction, running on the deployed and unmodified 1inch AquaSwapVMRouter, fills a swap only at the signed price, only before it expires and only within 800 bps of the onchain TWAP. The tokens never leave the agent's wallet. A SwapVM taker gate (WickGate) keeps the strategy closed to bots and open to Wick's own doors.

Every fill pays a 0.30% fee, and the fee is what keeps Wick alive. The agent swaps fees to W0G on Uniswap, bridges them to 0G over Chainlink CCIP, unwraps them and deposits them into the 0G Payment Layer account that bills its next decision. One AI decision costs about $0.00079; the live dashboard shows fuel, runway and every paid decision, read straight from both chains.

Anyone can trade with it: on the Wick app (a real wallet swap from the app: Base tx 0xe3ceac64cf0077c0305d677a11c1ad338cb81fbbcd06ab060094b924adfee7b1), through any Uniswap router via our v4 hook, or by buying the signed price over x402 for 0.01 USDC.

How it's Made

Pricing runs on 0G Private Computer. A TypeScript agent calls the 0G router with verify_tee on 0gm-1.0-35b-a3b (Intel TDX provider). The model returns four numbers: bid half-spread, ask half-spread, size, lifetime. It never writes a price. composeQuotes builds both rates around the Uniswap v3 600 second TWAP, refuses anything past 790 bps, and the pair is signed once as EIP-712. The 0G request id, provider and TEE verdict are bound into inferenceId = keccak256(abi.encode(requestId, provider, verdict)) and stored on AgentQuoteBoardV2 beside the quote, so anyone recomputes a price's provenance with cast keccak. An answer without tee_verified true, or without a request id, is refused before the signer.

Execution is a custom SwapVM instruction, AgentQuoteExtructionV2, invoked at Aqua opcode 0x20 on the deployed, unmodified AquaSwapVMRouter v1.0.2. Each fill checks the agent's epoch, expiry (900 s max), the signed rate against observe() on the Uniswap v3 pool, maxAmountIn and strategy depth, then charges 30 bps. A test pins the router's real opcode table. The live strategy sits behind SwapVM opcode 0x0e (_onlyTakerTokenBalanceNonZero), a taker gate whose WickGate token the v4 hook and maker hold, a shape 1inch's Aqua team pointed us to.

Uniswap shows up three ways: the v3 TWAP band, SwapRouter02 and QuoterV2 for funding swaps, and an AquaAggregatorHook on BaseAggregatorHook that turns the Aqua strategy into a v4 pool. The pool holds nothing; the hook is the SwapVM taker and settles to the PoolManager. Fork tests run through the deployed Universal Router 2.1.2.

The money loop is a Cloudflare Workers cron every five minutes. It reads TWAP, spot, vault, gas and board, and once fees reach 3x the live bridge cost it steps a persisted machine: swap fee USDC to W0G, ccipSend to the 0G chain, W0G.withdraw, PaymentLayer.depositFor(agent). A 1 0G daily spend cap drives NORMAL, LOW, CRITICAL and PAUSED tiers: a cheaper model and wider spreads, then no inference. LI.FI supplied gas on the 0G chain. A wick-quotes Worker sells signed prices over x402, each settlement bound to the payer's AuthorizationUsed event.

The hack we like most: the chain, not the server, enforces the agent's leash. Pull 0G away and every fill and every v4 swap reverts StaleQuote. Stack: Solidity and Foundry (69 contract tests with fuzz, invariants and Base fork runs, 20 hook fork tests), TypeScript, viem, Next.js, Cloudflare Workers and KV.

background image mobile

Join the mailing list

Get the latest news and updates

Wick | ETHGlobal