About
# AgentFund ๐ค๐ธ
**A marketplace where AI trading strategies are NFTs.** Mint your agent. Earn royalties on every dollar it manages. Forever.
---
## โจ The Idea
For DeFi to feel like a real product, capital has to be put to work without anyone babysitting it. AgentFund is the marketplace for that.
- ๐จ **Creators** mint a strategy as an intelligent NFT โ an *iNFT*. The agent's prompt, its model pointer, and a royalty cut all live on-chain.
- ๐ฐ **Depositors** browse the marketplace, pick a strategy, and deposit USDC into its ERC-4626 vault. The agent trades on their behalf.
- ๐ **Royalties flow forever.** 70% of fees to LPs, 20% to the protocol, 10% to the iNFT creator. The strategy is a portable asset โ transfer it, lease it, upgrade it. Its intelligence travels with it.
The agent itself is the interesting part. Its **brain** runs on 0G Compute (sealed inference, TEE-attested). Its **memory** lives on 0G Storage (append-only decision logs). Its **routing intelligence** comes from Uniswap (live mainnet liquidity). Its **execution** lands on-chain through KeeperHub (with a per-trade spending cap as the autonomous-payment ceiling).
---
## ๐ง How It Works
```
user deposits USDC โ โผ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ StrategyVault (ERC-4626) โ โโโโโโโโโโโโโฌโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ โ Agent Loop on 0G โ โ โ โ ๐ Analyst โ โ ๐ฆ Uniswap quote โ โ ๐ฆ 0G Compute (TEE) โ โ โ โ ๐ก๏ธ Risk gate โ โ ๐ฆ 0G Storage memory โ โ โ โ โก Executor โ โ ๐ฆ KeeperHub exec โ โ ๐ฆ Settle on 0G โ โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ โ fees split โ LPs + protocol + creator ```
Every tick is a real, end-to-end on-chain swap on 0G Galileo.
---
### ๐ฆ 0G โ agents as on-chain assets
Four primitives, all live on Galileo testnet:
iNFT registry (StrategyINFT) โ token #1 minted with on-chain intelligenceHash and 10% creator royalty
Vault StrategyVault โ ERC-4626, royalty-aware fee distribution
Settlement router SettlementRouter โ Uniswap-V2-shaped router native to 0G
Sealed inference 0G Compute via qwen/qwen-2.5-7b-instruct โ every analyst tick returns a TEE-attested receipt id stored alongside the decision
Append-only memory 0G Storage at strategy/<id>/decisions and strategy/<id>/executions โ the agent learns over time without forgetting
๐ **Live agent-driven swap on 0G:** https://chainscan-galileo.0g.ai/tx/0x37ace190b10902790f4ebb9bb1f883a0d1f3c371cf2f12972c45384afa819dde โ 100 mUSDC in, 99.95 mUSDT out, executed end-to-end by the agent.
---
### ๐ฆ Uniswap โ routing intelligence
The agent doesn't pretend to know markets. On every tick it calls Uniswap's **Trade API** on mainnet:
- `POST /v1/quote` with the strategy's pair, size, and slippage tolerance
- Pulls back `amountOut`, `priceImpact`, the full `route` across pools, and `gasFeeUsd`
- Feeds those numbers directly into the 0G Compute prompt
So even though settlement happens on 0G, every decision is grounded in real mainnet liquidity. The LLM is never asked to guess prices it can't see.
๐ **Code:** apps/web/lib/uniswap/client.ts `apps/web/lib/agent/analyst.ts`
---
### ๐ฆ KeeperHub โ autonomous execution with a spending cap
Every executor decision flows through KeeperHub's **Direct Execution API**:
- The agent's runtime wallet is the org's https://chainscan-galileo.0g.ai/address/0xb62b29BfA8A23fc13Fa1301F0c75ca7cDDF9f250 provisioned at app.keeperhub.com
- Each call: `POST /api/execute/contract-call` with the swap calldata and `network: "16602"` (0G Galileo)
- The **org-level spending cap** is the per-execution autonomous-payment ceiling โ exactly the role the x402 standard is reaching for
- KeeperHub job IDs are recorded in 0G Storage alongside every settlement, so the audit trail is complete
๐ **Code:** apps/web/lib/keeperhub/client.ts
---
## ๐ Live Deployment
**Network:** 0G Galileo testnet ยท **Chain ID:** `16602` ยท **Explorer:** https://chainscan-galileo.0g.ai
StrategyINFT (registry) `0xa71a26a93F318F82a7DbA6aAf8aef9cD2c5B7E15`
StrategyVault `0x0C9955428da76AD04539AbFF63f6Abe76441aca2
SettlementRouter 0x3AF5B121dE056755d8D751b21f7885dE03A87efE`
Mock USDC (mUSDC) | 0xb38124095d7Dce2483A449f7555f457f936B9c47 |
Mock USDT (mUSDT) | 0x15B934832E1E15072441AE7815F996F636fd1D42` |
How it's made
**Strategy iNFT #1** โ *"Conservative USDC Yield"* โ minted with `intelligenceHash = 0x036c6d4555cf0634fd6e2284372c7a95fd8ef2130352fa67f58765d596a24c75`, royalty `1000` bps to creator.
## ๐ ๏ธ Stack
Next.js 15 ยท TypeScript ยท Tailwind ยท viem ยท wagmi ยท Foundry ยท 0G Compute + Storage ยท Uniswap Trade API ยท KeeperHub Direct Execution
## ๐ Run It Yourself
See DEPLOY.md for local setup and the demo walkthrough.
From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.






