AI Cosigner: LLM-signed intents to safely trade on Base with one click
AI Cosigner turns plain English like “Buy BTC with 50% of my funds” into a verifiable, policy-constrained on-chain action. The system separates “decision” from “execution”: the backend asks an LLM for a recommendation and signs a typed intent (EIP-712), while smart contracts on Base enforce guardrails and execute the trade only when the user confirms in their wallet. Funds never touch the server.
Smart contracts (Solidity 0.8.26, OpenZeppelin v5) AIIntentVerifier: EIP-712 domain (name: "AI Cosigner", version: "1"), policy guardrails (token allow-list, min/max sizeBps, max slippage, TTL), anti-replay via digest, optional executor lock, hashes for prompt/inputs/reason. SignatureChecker supports EOA/EIP-1271.
ActionRouter: previewIntent (Uniswap QuoterV2) and executeIntent (Uniswap SwapRouterV3). Computes amountIn, quotes amountOut, applies minOut = quote*(1-slippage), pulls tokens via transferFrom (or EIP-2612 permit), clears approvals, emits Executed. Backend (Node + TypeScript + Express). Frontend (React + wagmi v2 + viem): Workflow: https://github.com/LoginovIlia/AI-Cosigner/blob/master-of-puppets/.github/diagram.png