An autonomous AI agent that earns its own operating budget from DeFi yield, pays for its own compute, and provides paid financial services — without ever touching the principal.
Built for The Synthesis Hackathon 2026
Live Dashboard: devanshug2307.github.io/autofund-agent
Every AI agent today depends on a human to pay its bills — compute, API calls, data feeds. This creates a hard dependency that limits true agent autonomy: when the funding stops, the agent stops.
AutoFund is the first autonomous agent that earns its own operating budget from DeFi yield, pays for its own LLM inference, and provides paid financial services — all without ever touching the locked principal. It is a working prototype of self-sustaining agent economics.
AutoFund is an autonomous agent that:
- Deposits funds into a yield-bearing vault (Lido stETH)
- Locks the principal — the agent can never withdraw it (enforced at smart contract level)
- Harvests only the yield (interest earned)
- Pays for its own LLM inference using Bankr API
- Trades autonomously via Uniswap V3 (real onchain swaps, not just quotes)
- Provides paid services (portfolio analysis) to earn revenue
- Reinvests earnings to grow its operational budget
- Runs autonomously as a daemon with WAKE→SENSE→THINK→ACT→CHECK→LOG→SLEEP lifecycle
The agent is structurally constrained: spending guardrails (per-tx limits, daily caps) enforce responsible behavior at the smart contract level. 110 tests (47 Solidity + 63 Python) prove the principal can never be withdrawn.
┌─────────────────────────────────────────────────┐
│ AUTOFUND AGENT (Bankr API) │
│ 20+ LLM models + onchain wallet │
├─────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌──────────┐ ┌────────────────┐ │
│ │ Treasury │ │ Trading │ │ Service │ │
│ │ Manager │ │ Engine │ │ Provider │ │
│ │ │ │ │ │ │ │
│ │ • Deposit │ │ • Uniswap│ │ • Portfolio │ │
│ │ • Lock │ │ V3 swap│ │ analysis │ │
│ │ • Harvest │ │ • Real │ │ • Vault │ │
│ │ yield │ │ onchain│ │ monitoring │ │
│ │ • Pay for │ │ • P&L │ │ • Plain English│ │
│ │ compute │ │ tracking│ │ reports │ │
│ └─────┬─────┘ └────┬─────┘ └───────┬────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────┐ │
│ │ SMART CONTRACTS (Base Sepolia) │ │
│ │ │ │
│ │ TreasuryVault ServiceRegistry │ │
│ │ ┌──────────────┐ ┌──────────────────┐ │ │
│ │ │ deposit() │ │ registerService() │ │ │
│ │ │ harvestYield()│ │ requestService() │ │ │
│ │ │ spend() │ │ completeService() │ │ │
│ │ │ getStatus() │ │ (escrow payments) │ │ │
│ │ │ Guardrails: │ └──────────────────┘ │ │
│ │ │ $100/tx max │ │ │
│ │ │ $500/day max│ │ │
│ │ └──────────────┘ │ │
│ └─────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘
Human deposits $1,000 → Principal LOCKED in TreasuryVault
→ Agent stakes in Lido stETH (~3.5% APY, fetched live from eth-api.lido.fi)
→ Yield accrues → Agent harvests $50 yield (onchain TX: 0x93053c...)
→ Yield pays for 5 Bankr LLM inferences (cost: $0.003)
→ Agent provides 3 paid portfolio analyses ($1 each)
→ Revenue: $3.00 | Cost: $0.003 | NET: $2.997 (PROFITABLE)
→ Agent can run ~100,000 more inferences before needing more yield
| Contract | Network | Address | Verified |
|---|---|---|---|
| TreasuryVault | Base Sepolia | 0xDcb6aEdb34b7c91F3b83a0Bf61c7d84DB2f9F2bF |
Yes |
| ServiceRegistry | Base Sepolia | 0xa602931E5976FA282d0887c8Bd1741a6FEfF9Dc1 |
Yes |
| Mock USDC | Base Sepolia | 0x5cFA9374C4DcdFE58A32d2702d73bB643cc85A36 |
Yes |
| Mock stETH | Base Sepolia | 0xC7EBEcBfb08B437B6B00d51a7de004E047B4B116 |
Yes |
| TreasuryVault | Celo Sepolia | 0x8635671a298Bb1da6d0c48CabDb943595Cb9335d |
Yes |
| ServiceRegistry | Celo Sepolia | 0xb3cf6c10889e674D6958d7177D05D175F9191818 |
Yes |
| Mock USDC | Celo Sepolia | 0xfCb9859F0Cec6b4100b30e20238C2047546Ab78e |
Yes |
| Mock cUSD | Celo Sepolia | 0x6b66638D2dDcc2e1b74cE157bb15aB088a3d4545 |
Yes |
| PrivacyVault (VaultGuard) | Status Network Sepolia | 0xDcb6aEdb34b7c91F3b83a0Bf61c7d84DB2f9F2bF |
Yes |
Every claim is verifiable on BaseScan and Blockscout:
| # | Action | TX Hash | What It Proves |
|---|---|---|---|
| 1 | Mint 10,000 mUSDC | 0x813fa0... |
Token creation |
| 2 | Deposit $1,000 into TreasuryVault | 0x08152b... |
Principal locked |
| 3 | Yield accrual ($50) | 0xc74497... |
Yield arrives |
| 4 | Agent harvests $50 yield | 0x93053c... |
Only yield withdrawn, principal untouched |
| 5 | Register "AI Portfolio Analysis" service | 0xb55229... |
Service marketplace |
| 6 | Agent spends $5 on LLM inference | 0x699fd2... |
Self-funding compute |
| 7 | Register "Vault Monitor" service | 0x1f9090... |
Second service |
| 8 | Register "DeFi Yield Optimizer" | 0x52f1b4... |
Third service |
| 9 | Request service ($2 escrowed) | 0x298b2a... |
Payment escrowed |
| 10 | Complete service (payment released) | 0x5bdae3... |
Full lifecycle proven |
| # | Action | TX Hash | What It Proves |
|---|---|---|---|
| 1 | Swap 0.0005 ETH → 2.773624 USDC | 0x42308f... |
Real Uniswap V3 swap executed onchain |
| 2 | Swap 0.0003 ETH → 1.664174 USDC | 0xa2e288... |
Integrated swap via AutoFund trading engine |
Both swaps use Uniswap V3 SwapRouter02 (
0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E) withexactInputSingleviamulticall. Verify both TX hashes on sepolia.etherscan.io.
ERC-8004 Identity: 0x989089... (Base Mainnet)
| # | Action | TX Hash | What It Proves |
|---|---|---|---|
| 1 | Mint 10,000 mUSDC | 0x340ca1... |
Token creation on Celo |
| 2 | Deposit $1,000 into TreasuryVault | 0xe2610e... |
Principal locked on Celo |
| 3 | Agent harvests $50 yield | 0x5e7f0d... |
Yield withdrawal on Celo |
| 4 | Register service ($1/request) | 0x872022... |
Service marketplace on Celo |
| 5 | Agent spends $5 on inference | 0x8e5feb... |
Self-funding on Celo |
| 6 | Service requested ($1 escrowed) | 0x32c4a6... |
Escrow on Celo |
| 7 | Service completed (payment released) | 0x93d00f... |
Full lifecycle on Celo |
Every integration below was tested against real APIs — no mocks, no stubs. Proof files contain full HTTP request/response pairs.
| # | Integration | Proof File | What It Proves |
|---|---|---|---|
| 1 | Telegram Alerts | telegram_real_alert_proof.json |
Real alerts delivered to live Telegram chat (message_id: 3, 4) |
| 2 | Lido APY | lido_live_proof.json |
Live stETH SMA APY 2.42% from eth-api.lido.fi (HTTP 200) |
| 3 | Bankr API | bankr_api_proof.json |
API key valid (402 not 401), gateway healthy, all 3 providers online |
| 4 | Uniswap V3 Swaps | swap_proof.json |
2 real swaps executed onchain — 0.0008 ETH → 4.44 USDC via SwapRouter02 on Sepolia |
| 5 | Autonomous Daemon | daemon_session.json |
3 complete autonomous cycles — 6/6 self-checks passing, live APY + ETH price, Telegram alerts |
- Code:
src/service_api.py— x402 middleware with fail-closed enforcement (line 75+) - Protocol: x402 — HTTP 402 Payment Required standard for machine-to-machine payments
- Implementation: Direct HTTP 402 middleware in FastAPI with fail-closed enforcement — the middleware runs on every request to paid routes, there is no bypass mode, no config flag to disable it, and no fallback where endpoints are ungated. If payment verification fails, the response is always 402.
- Facilitator:
https://x402.org/facilitator— handles payment verification and settlement - Network: Base Sepolia (
eip155:84532) — same chain as deployed contracts - Scheme:
exact— EVM exact payment (EIP-712 signed authorization) - Pay-to:
0x54eeFbb7b3F701eEFb7fa99473A60A6bf5fE16D7 - Paid endpoints:
POST /portfolio/analyze($0.01),GET /vault/report($0.005) - How it works: Unpaid requests to gated endpoints receive HTTP 402 with full x402 payment requirements (scheme, network, payTo, price, facilitator URL). Clients construct a signed payment and resend with the
X-PAYMENTheader. The server verifies against the facilitator and serves the resource. - Why x402: Enables any agent or human to pay for AutoFund's services programmatically — no accounts, no API keys, just onchain payments. This turns AutoFund into a real paid service that other agents can discover and use autonomously.
- Always enforced: The x402 middleware runs on every request to paid routes — there is no fallback mode where endpoints are ungated.
- Code:
src/bankr_integration.py—BankrGatewayclass with cost-optimized model selection - Endpoint:
https://llm.bankr.bot/v1/chat/completions - Auth:
X-API-Keyheader (verified working, responds 402 confirming valid key) - Models: 20+ (Claude, GPT, Gemini) with automatic cost-optimized selection
- Self-funding: Agent selects cheapest model per task complexity (Gemini Flash for simple, Claude Sonnet for analysis, Opus for critical decisions)
- Economics: 0.002% budget utilization across 5 inferences — agent can run ~100,000 calls before needing more yield
- API Key Validated: Bankr gateway returns HTTP 402
insufficient_credits— this proves the key IS valid and recognized (a fake key would return 401unauthorized) - Health Check: All 3 providers online —
vertexGemini,vertexClaude,openrouter(HTTP 200 fromllm.bankr.bot/health) - Proof:
bankr_api_proof.json— full API call/response, health check, model selection logic, fallback chain
Note: The TreasuryVault is designed to work with ANY yield-bearing ERC20 token, not just stETH. The contract accepts a generic
depositTokenandyieldTokenat deploy time, so the same vault architecture supports stETH, wstETH, aUSDC (Aave), cDAI (Compound), or any future yield-bearing token. We tested with mock ERC20 tokens on Base Sepolia because Lido's stETH is not deployed on testnets — but the on-chain logic is identical to what would run with real stETH on mainnet. The 110 passing tests (47 Solidity + 63 Python) validate all deposit, yield, spend, and guardrail mechanics regardless of the underlying token.
- Code:
contracts/TreasuryVault.sol(vault),src/mcp_server.py+src/mcp_stdio_server.py(MCP),src/monitor.py(monitor + Telegram) - Treasury primitive: TreasuryVault.sol — principal locked at contract level, only yield withdrawable. 110 tests (47 Solidity + 63 Python) prove this.
- MCP server (stdio transport): 10 tools over JSON-RPC stdin/stdout —
stake_eth,unstake_steth,wrap_steth,unwrap_wsteth,get_balance,get_rewards,get_apy,get_governance_votes,monitor_position,vault_health. All write operations supportdry_run. This is NOT a REST API wrapper — it's a real MCP stdio server that Claude Desktop and Cursor can connect to directly. - Real Lido contract addresses and ABIs for mainnet + Holesky included in code.
- Live APY: Fetches real-time stETH APY from
eth-api.lido.fi/v1/protocol/steth/apr/sma— verified live: 2.42% SMA APY (HTTP 200, 7-day APR history included). Proof:lido_live_proof.json - Vault Monitor with Telegram alerts: Plain-English reports tracking yield vs benchmarks (Aave, rETH, raw staking), allocation shifts across Aave/Morpho/Pendle/Gearbox/Maple. Alerts are pushed to Telegram via Bot API (not a dashboard the user has to check). Set
TELEGRAM_BOT_TOKENandTELEGRAM_CHAT_IDto enable. - Real Telegram alerts delivered to a live chat (message_id: 3 and 4):
- Alert 1: Full vault monitoring report with live stETH APY (2.42%), ETH price ($2,108), benchmark comparison against Aave and rETH
- Alert 2: Yield drop detection alert with allocation analysis across Aave/Morpho/Pendle/Gearbox/Maple
- Bot:
@web3203botdelivering to a real private chat - Proof:
telegram_real_alert_proof.jsonwith full Telegram APIsendMessageresponses
Telegram Alert Screenshot (live proof):
- MCP-callable vault_health: Structured JSON health check tool callable by other agents — returns status, APY spread, allocation, alerts, and recommended actions (bonus agent-to-agent interop).
- Skill file:
lido.skill.mdgives agents the mental model (rebasing mechanics, wstETH vs stETH, L2 bridging, safe patterns, governance)
REAL EXECUTED SWAPS — not quotes, not simulations. Both transactions are verifiable on Ethereum Sepolia Etherscan.
- Code:
src/uniswap_trader.py— trading engine with multi-timeframe momentum analysis and quarter-Kelly criterion position sizing;scripts/real_swap_sepolia.py— standalone swap script - Router: Uniswap V3 SwapRouter02
0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48Eon Ethereum Sepolia - Method:
exactInputSingleviamulticall— the standard Uniswap V3 swap path - Network: Ethereum Sepolia (chainId 11155111)
| # | Swap | TX Hash | Etherscan |
|---|---|---|---|
| 1 | 0.0005 ETH → 2.773624 USDC | 0x42308f... |
Verify on Etherscan |
| 2 | 0.0003 ETH → 1.664174 USDC | 0xa2e288... |
Verify on Etherscan |
- Swap 1: Standalone swap script proving direct Uniswap V3 interaction
- Swap 2: Integrated swap executed through AutoFund's
uniswap_trader.pytrading engine (block 10496806, gas used: 117,588) - Total swapped: 0.0008 ETH → 4.437798 USDC (effective rate: ~$5,547/ETH)
- Proof file:
swap_proof.json— full TX hashes, block numbers, gas usage, amounts - API Key: Real key from Uniswap Developer Platform (verified)
- Additional quote proof:
uniswap_mainnet_quote.json— real 1 ETH → USDC quote on Base mainnet - CoinGecko fallback: Real-time price feed for market analysis
- P&L tracking: Portfolio value, trade history, performance reports
- Signal-based trading strategy: The agent does not trade randomly. It computes short-window and mid-window momentum across multiple timeframes, estimates realized volatility from price history, and applies quarter-Kelly criterion position sizing (
kelly_fraction=0.25). Trade sizes are mathematically derived:Kelly raw = (win_rate * avg_win - loss_rate * avg_loss) / avg_win, then scaled by volatility dampening factor. This produces risk-adjusted position sizes, not arbitrary percentages.
- Code:
scripts/deploy-base.cjs(deployment),contracts/ServiceRegistry.sol(escrow marketplace) - 4 contracts deployed on Base Sepolia
- 10+ verified onchain transactions
- Full service lifecycle proven: Register → Request → Escrow → Complete → Pay
Not just "deploy same contracts on another chain" — AutoFund has a dedicated
CeloAgentclass (src/celo_integration.py) that uses Celo-specific features no other chain offers, including CIP-64 fee abstraction (pay gas in cUSD instead of native CELO) and cross-border remittance via Mento protocol.
- 4 contracts deployed on Celo Sepolia including a dedicated Mock cUSD for native stablecoin operations
- 7 verified onchain transactions — full lifecycle: mint, deposit, harvest, spend, register, request, complete
CeloAgentclass (src/celo_integration.py) provides 6 Celo-specific capabilities:
| # | Capability | Method | Celo-Unique? |
|---|---|---|---|
| 1 | Stablecoin Balance Tracking | get_stablecoin_balances() |
cUSD, cEUR, cREAL, USDC with live FX rates via CoinGecko |
| 2 | Fee Abstraction (CIP-64) | build_fee_abstraction_tx() |
Yes — pay gas in cUSD/cEUR instead of CELO |
| 3 | MiniPay Transfers | build_minipay_transfer() |
Yes — optimized for Celo MiniPay (2M+ users) |
| 4 | Cross-Border Remittance | quote_remittance() / execute_remittance() |
Yes — cUSD→cEUR→cREAL via Mento protocol |
| 5 | TreasuryVault on Celo | read_celo_vault_status() |
Reads deployed vault contract on Celo Sepolia |
| 6 | Stablecoin Payments | process_stablecoin_payment() |
Entire payment flow uses stablecoins (transfer + gas) |
- Fee abstraction (CIP-64): The agent pays gas fees in cUSD instead of native CELO — aligning with a stablecoin-denominated budget. No volatile token holdings needed for operations.
- Cross-border remittance: Send cUSD→cEUR→cREAL via Mento protocol with ~$0.001 total cost and <5 second settlement (vs $15-45 and 1-3 days for wire transfers).
- MiniPay-compatible: Transaction construction optimized for Opera Mini's MiniPay wallet — minimal calldata, fee abstraction, sub-cent costs.
- Native stablecoins: cUSD, cEUR, cREAL enable multi-currency treasury management without third-party bridges.
- Explorer: celo-sepolia.blockscout.com
- Code:
scripts/deploy-status.cjs— deployment script for Status Network Sepolia - PrivacyVault (VaultGuard) deployed on Status Network Sepolia — gasless at the protocol level (gas price = 0), no ETH needed for any transaction
- Contract:
0xDcb6aEdb34b7c91F3b83a0Bf61c7d84DB2f9F2bF - Deploy TX:
0xaa1b03...— verifiable gasless deployment - Why Status: Zero gas fees make it ideal for continuous autonomous agent operations — no gas budgeting required, every daemon cycle can commit proofs onchain at zero cost
- Explorer: sepoliascan.status.network
110 tests passing (47 Solidity + 63 Python) — run with:
# Solidity tests (47/47)
npx hardhat --config hardhat.config.cjs test
# Python tests (63)
python3 -m pytest tests/ -vTest coverage:
- TreasuryVault (36 tests): Deposits, yield tracking, principal protection (4 tests proving agent can NEVER withdraw principal), access control, spending guardrails (exact-limit edge cases), events, comprehensive status
- ServiceRegistry (11 tests): Registration, deactivation, full lifecycle with escrow, multi-user scenarios, double-completion prevention
# Clone
git clone https://github.com/devanshug2307/autofund-agent.git
cd autofund-agent
# Install
pip install -r requirements.txt
npm install
# Run the full demo (proves profitability)
python3 -m src.demo_full_loop
# Run as autonomous daemon (continuous operation)
python3 -m src.daemon --cycles 3 --interval 60
# Run Solidity tests (47/47)
npx hardhat --config hardhat.config.cjs test
# Run Python tests (63)
python3 -m pytest tests/ -v
# Deploy contracts (needs Base Sepolia ETH)
npx hardhat --config hardhat.config.cjs run scripts/deploy-base.cjs --network baseSepoliaThe agent runs as a continuous daemon with a structured lifecycle:
WAKE → Check time, decide if action needed
SENSE → Read treasury status, market conditions, vault health
THINK → Analyze data with LLM (Bankr), generate insights
ACT → Harvest yield, execute trades, provide services, push Telegram alerts
CHECK → Verify actions succeeded, track self-sustainability (6/6 self-checks)
LOG → Record all activity for auditability
SLEEP → Wait for next cycle
python3 -m src.daemon --cycles 3 --interval 60Multi-cycle proof: daemon_session.json — 3 complete autonomous cycles with 6/6 self-checks passing each cycle. The daemon fetches live Lido APY (2.5%), live ETH price ($2,067–$2,068 from CoinGecko), runs Bankr LLM analysis, generates vault monitoring reports, and pushes Telegram alerts when issues are detected — all without human intervention.
After each daemon cycle, the agent runs self_check.py to verify its own operations. Six checks are performed every cycle:
- Treasury principal intact — re-reads on-chain status, confirms principal is non-negative
- Yield non-negative — verifies available yield has not gone negative
- Net position sustainable — confirms revenue minus costs is tracking correctly
- No critical alerts — checks that no critical vault alerts were missed
- Inference budget remaining — verifies Bankr budget has not been exhausted
- Lido APY sanity — ensures APY data is in a sane range (not stale or anomalous)
Each cycle produces a structured PASS/FAIL verdict with recommendations if any check fails.
src/service_api.py exposes AutoFund as a discoverable HTTP service on Base via FastAPI, with premium endpoints gated by the x402 payment protocol.
uvicorn src.service_api:app --host 0.0.0.0 --port 8000Premium endpoints require payment via the x402 protocol — the HTTP 402 "Payment Required" standard for machine-to-machine payments. The x402 middleware uses fail-closed enforcement — it is always active with no bypass mode. Unpaid requests to gated endpoints return HTTP 402 with full payment requirements (scheme, network, payTo, price, facilitator URL). If payment verification fails, the response is 402 (see service_api.py line 140: "Payment verification failed -- return 402 (fail-closed)"). Clients construct a signed payment and resend with the X-PAYMENT header.
| Paid Endpoint | Price | What You Get |
|---|---|---|
POST /portfolio/analyze |
$0.01 | AI-powered wallet analysis with DeFi positions and risk |
GET /vault/report |
$0.005 | Plain-English Lido vault monitoring report |
Configuration:
- Facilitator:
https://x402.org/facilitator(handles payment verification + settlement) - Network: Base Sepolia (
eip155:84532) - Pay-to address:
0x54eeFbb7b3F701eEFb7fa99473A60A6bf5fE16D7 - Scheme:
exact(EVM exact payment)
How agents/humans pay:
- Send a request to a paid endpoint (e.g.,
POST /portfolio/analyze) - Receive HTTP 402 with payment requirements in the response
- Use x402 client SDK to sign a payment for the required amount
- Resend the request with
payment-signatureheader - Server verifies payment via facilitator, serves the resource, and settles
Example with x402 Python client:
from x402.http.clients.httpx import x402_httpx_client
import httpx
client = x402_httpx_client(httpx.Client(), signer=your_evm_signer)
response = client.post("http://localhost:8000/portfolio/analyze",
json={"wallet_address": "0x..."})
# x402 client automatically handles the 402 → pay → retry flowPaid (x402 gated):
POST /portfolio/analyze— AI-powered portfolio analysis ($0.01)GET /vault/report— Vault monitoring report ($0.005)
Free:
GET /— Service discovery root with full endpoint listing and x402 infoGET /services— List all services with pricingGET /services/catalog— Full catalog with examples and descriptionsGET /vault/alerts— Run monitoring checks, return alertsGET /lido/apy— Current Lido stETH APY with benchmarksPOST /lido/stake— Simulate staking (dry-run default)GET /lido/balance— Query stETH/wstETH balancesGET /lido/governance— Active Lido DAO proposalsGET /market/price— Real-time ETH/USD priceGET /market/quote— Swap quote for any token pairGET /agent/status— Self-sustainability metricsGET /x402/status— x402 payment protocol status and configurationGET /health— Health check
autofund-agent/
├── contracts/
│ ├── TreasuryVault.sol # Principal-locked yield vault
│ ├── ServiceRegistry.sol # Agent service marketplace with escrow
│ └── MockERC20.sol # Test tokens
├── src/
│ ├── agent.py # Core agent: treasury, trading, services
│ ├── mcp_server.py # Lido MCP server core (10 tools + dry_run)
│ ├── mcp_stdio_server.py # MCP stdio transport (JSON-RPC over stdin/stdout)
│ ├── monitor.py # Vault monitor + Telegram alerts + vault_health
│ ├── uniswap_trader.py # Trading engine: Uniswap V3 swaps + Kelly criterion sizing
│ ├── bankr_integration.py # Self-funding via Bankr Gateway
│ ├── daemon.py # Autonomous daemon mode
│ ├── self_check.py # Post-cycle self-verification (6 checks)
│ ├── service_api.py # Discoverable HTTP service API (FastAPI)
│ ├── celo_integration.py # Celo-specific: fee abstraction, stablecoins, remittance
│ └── demo_full_loop.py # 6-phase profitability demo
├── scripts/
│ ├── deploy.cjs # Local deployment + demo
│ ├── deploy-base.cjs # Base Sepolia deployment
│ ├── deploy-celo.cjs # Celo Sepolia deployment
│ ├── deploy-vault.cjs # Vault-only deployment
│ ├── deploy-status.cjs # Status L2 deployment
│ ├── onchain-demo.cjs # Treasury onchain demo
│ ├── onchain-demo2.cjs # Service lifecycle demo
│ ├── real_swap_sepolia.py # Standalone Uniswap V3 swap on Sepolia
│ └── real_swap_round_trip.py # Integrated swap via trading engine
├── test/
│ ├── TreasuryVault.test.cjs # 17 core tests
│ ├── TreasuryVault.advanced.test.cjs # 22 advanced tests
│ └── ServiceRegistry.test.cjs # 8 service tests
├── dashboard/
│ └── index.html # Live dashboard
├── docs/
│ └── index.html # GitHub Pages deployment
├── lido.skill.md # Lido skill file for agents
├── BUILD_STORY.md # Hackathon build story
├── telegram_real_alert_proof.json # Proof: real Telegram alerts delivered (message_id 3,4)
├── lido_live_proof.json # Proof: live stETH APY 2.42% from eth-api.lido.fi
├── bankr_api_proof.json # Proof: Bankr API key valid, all providers online
├── swap_proof.json # Proof: 2 real Uniswap V3 swaps on Sepolia (TX hashes, amounts, gas)
├── uniswap_mainnet_quote.json # Verified Uniswap API quote proof
├── uniswap_quote_proof.json # Additional quote proof
├── agent.json # Agent identity + capabilities descriptor
├── agent_log.json # Full agent activity log (all cycles)
├── telegram_alert_proof.json # Proof: initial Telegram alert test
├── telegram_alert_proof.txt # Proof: Telegram alert text output
├── telegram_alert_screenshot.png # Screenshot: real Telegram alerts
├── daemon_session.json # Proof: 3-cycle autonomous daemon run (6/6 self-checks per cycle)
├── demo_output.json # Full demo activity log
├── demo_proof.txt # Proof: full demo run output
├── deployment-celo.json # Celo Sepolia deployment addresses + TX hashes
├── mcp_proof.txt # Proof: MCP server test output
├── mcp_smoke_test_output.txt # Proof: MCP stdio server smoke test output
├── monitor_proof.txt # Proof: vault monitor output
├── octant_proof.txt # Proof: Octant public goods evaluator output
├── alert_history.json # Alert history log
├── hardhat.config.cjs
├── requirements.txt
├── .env.example
└── README.md
| Metric | Value |
|---|---|
| LLM Inferences | 5 calls |
| Inference Cost | $0.003 |
| Services Provided | 3 analyses |
| Service Revenue | $3.00 |
| Net Profit | $2.997 |
| Budget Utilization | 0.002% |
| Remaining Capacity | ~100,000 inferences |
| Yield Source | Lido stETH (~3.5% APY, live) |
Most "DeFi agents" are either chatbots that suggest trades or bots that execute hardcoded strategies. AutoFund is structurally different:
- Self-sustaining economics — The agent funds its own compute from yield it earns. No human tops up an API key. Revenue exceeds costs by 1000x ($2.997 net on $0.003 spend), proving the economic loop closes.
- Principal can never be withdrawn — This is not a policy or a prompt instruction. It is enforced at the Solidity level with 110 tests (47 Solidity + 63 Python) proving the invariant holds under every edge case. The agent is structurally constrained, not just instructed.
- Signal-based trading, not random — The trading engine uses multi-timeframe momentum analysis (short + mid windows), realized volatility estimation, and quarter-Kelly criterion position sizing. Trade sizes are mathematically optimized based on confidence, win rate, and volatility dampening — not fixed percentages or random amounts.
- Closed-loop autonomy — Deposit locks principal, yield funds inference, inference powers services, services earn revenue, revenue funds more inference. Each step is proven onchain with verifiable TX hashes.
- Fail-closed payment enforcement — x402 middleware is always active. There is no config flag, no bypass mode, no "free tier fallback." Unpaid requests to gated endpoints return HTTP 402 every time.
This is a prototype for the future of autonomous AI operations:
- No human needs to manage the agent's budget
- DeFi yield becomes infrastructure for AI compute
- Smart contract guardrails enforce responsible spending (not just policy — code)
- Agent-to-agent service markets emerge from the ServiceRegistry
- Self-sustaining economics proven: revenue exceeds costs
- Dashboard: devanshug2307.github.io/autofund-agent
- GitHub: github.com/devanshug2307/autofund-agent
- Moltbook: moltbook.com/u/autofundagent
- Moltbook Post: AutoFund on m/synthesis
- ERC-8004 Identity: BaseScan TX
- TreasuryVault: BaseScan
- ServiceRegistry: BaseScan
| # | Track | Sponsor | What We Built |
|---|---|---|---|
| 1 | Synthesis Open Track | Synthesis | Full self-sustaining agent across DeFi, LLM, trading |
| 2 | Best Agent on Celo | Celo | CeloAgent: fee abstraction (CIP-64), cUSD/cEUR/cREAL stablecoins, MiniPay transfers, cross-border remittance via Mento |
| 3 | Let the Agent Cook — No Humans Required | Protocol Labs | 7-phase daemon, agent.json, agent_log.json |
| 4 | Best Bankr LLM Gateway Use | Bankr | Self-funding inference, cost-optimized model selection |
| 5 | Lido MCP | Lido | 10-tool MCP stdio server with dry_run |
| 6 | stETH Agent Treasury | Lido | Principal-locked vault, 110 tests (47 Solidity + 63 Python), yield-only withdrawal |
| 7 | Vault Position Monitor + Alert Agent | Lido | Telegram alerts, benchmark comparison, plain-English reports |
| 8 | Agent Services on Base | Base | ServiceRegistry with escrow, x402 payment protocol |
| 9 | Autonomous Trading Agent | Base | Real Uniswap V3 swaps on Sepolia, P&L tracking |
| 10 | Agentic Finance (Uniswap API) | Uniswap | 2 real onchain swaps via SwapRouter02 |
| 11 | Agents With Receipts — ERC-8004 | Protocol Labs | ERC-8004 identity on Base Mainnet |
- Agent: AutoFund (Claude Opus 4.6)
- Human: Devanshu Goyal (@devanshugoyal23)
- Hackathon: The Synthesis — March 2026
MIT


