Autonomous on-chain DeFi baskets with AI-powered rebalancing, self-sustaining yield, and cross-chain payment infrastructure.
Darwin lets anyone invest in thematic crypto baskets (on-chain ETFs). An autonomous AI agent monitors portfolio drift, rebalances positions via Uniswap V3, funds its own gas costs through DeFi yield, and operates across Base, Unichain, and Celo — fully on-chain, fully autonomous.
Built for the Synthesis Hackathon — targeting Uniswap, Celo, Base, Locus, and Zyfai bounties.
| Bounty | Track | What Darwin Does | Docs |
|---|---|---|---|
| Uniswap ($5k) | DeFi Integration | 12 basket vaults swap via Uniswap V3 on Base + Unichain. DarwinSwapRouter calls pool.swap() directly via factory.getPool(). |
Contracts |
| Celo ($5k) | Real-World Assets | 3 baskets on Celo mainnet including Global Stables (cUSD/cEUR/eXOF) — real-world FX diversification. Fee abstraction for gas in stablecoins. | Celo README |
| Base | L2 Infrastructure | 5 production vaults on Base mainnet with Chainlink oracles, autonomous agent, and Aave V3 yield. | Deploy Script |
| Locus | AI Payment Infrastructure | Smart wallet for autonomous rebalancing payments with spending guards ($50/tx, $500/day), on-chain audit trail, wallet connect UI. | Locus README |
| Zyfai ($600) | Yield-Powered AI Agents | Self-sustaining yield engine: idle USDC captured from DARW-EU vault -> Zyfai Safe (ERC-4337) -> Aave V3 -> harvest yield -> fund agent operations. | Zyfai README |
┌─────────────────────────────┐
│ Darwin Frontend (Next.js)│
│ /baskets /locus /zyfai │
└──────────┬──────────────────┘
│
┌────────────────┼────────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Base │ │ Unichain │ │ Celo │
│ 5 Vaults │ │ 4 Vaults │ │ 3 Vaults │
└─────┬─────┘ └──────────┘ └──────────┘
│
┌──────────┼──────────┐
▼ ▼ ▼
┌─────────┐ ┌───────┐ ┌───────┐
│ Zyfai │ │ Locus │ │Oracle │
│ Yield │ │Payment│ │ V2 │
│ Engine │ │ Guard │ │Chainlk│
└────┬────┘ └───┬───┘ └───────┘
│ │
▼ ▼
┌─────────┐ ┌────────────────┐
│ Aave V3 │ │ Rebalance Tx │
│ Yield │ │ (Uniswap V3) │
└─────────┘ └────────────────┘
│
└──► Harvest yield ──► Locus wallet ──► Funds rebalances
(self-sustaining loop)
| Contract | Address | Verified |
|---|---|---|
| DarwinOracleV2 | 0xAcA4E4334f801613C571b88f4aB986A715F00dAA |
✅ |
| DarwinSwapRouter | 0xEe3e4e560b1E50C6206410E351Ac227e7621d5A8 |
✅ |
| StrategyManager | 0x6Cce92f8878f2BA08Dc0852B37D63eb70B52D304 |
✅ |
| Zyfai Safe (ERC-4337) | 0xaFd6bD49d4B4886e27AE5e664591C6968A65D5eF |
✅ |
| Basket | Ticker | Composition | Vault Address |
|---|---|---|---|
| ETH/USDC Balanced | DARW-EU | 50% WETH / 50% USDC | 0x1a621359263F1C4Cd3bF732751C6db91dF8de585 |
| BTC/ETH Core | DARW-BE | 50% cbBTC / 50% WETH | 0x68c9488986444f23de4f035be05ceeb33e0f5cd2 |
| Big Crypto | DARW-BIG | 30% ETH / 30% BTC / 20% XRP / 20% SOL | 0x70fa23e91eec587a5ffae12284e310ca47899def |
| ETH Yield | DARW-EYD | 55% wstETH / 45% weETH | 0xc298f2fe60aba09fe7e179b4f488b6d0393aa2a1 |
| Multi-Asset | DARW-MA | 30% XRP / 30% SOL / 40% AVAX | 0x350cc5f212fed0c025413a95f4f2ac5ab3d9f90a |
| Basket | Ticker | Composition | Vault Address |
|---|---|---|---|
| DeFi Blue Chip | DARW-DBC | 30% HYPE / 40% WETH / 30% UNI | 0x5288b2c438af7da20a8ac43094272aa913abcdba |
| Crypto Index | DARW-CIX | 30% SOL / 30% WBTC / 40% WETH | 0xfb26bc8d4c414fb5e930dc4545dfc76358b61896 |
| ETH Yield | DARW-EYD | 50% wstETH / 50% WETH | 0x5f80816ea5ede97e0bd7584fbad7dd7e8277d4f6 |
| BTC/ETH Core | DARW-BE | 50% WBTC / 50% WETH | 0x701c66931f0c4ce23aef64cc7f06816d618026fc |
| Basket | Ticker | Composition | Vault Address |
|---|---|---|---|
| Celo Ecosystem | DARW-CELO | 60% CELO / 40% USDT | 0x98afb302dadb287384c7ffe05297670513b77a7d |
| CELO/ETH Core | DARW-CE | 50% CELO / 50% WETH | 0x6cce92f8878f2ba08dc0852b37d63eb70b52d304 |
| Global Stables | DARW-GS | 35% cUSD / 30% cEUR / 35% eXOF | 0x6bfaba3c46b9492302875372887b35bd5ee4da4e |
A single oracle contract deployed on every chain with a unified getPrice(address) interface. Supports four price source types:
- CHAINLINK — Live feeds from Chainlink (ETH/USD, BTC/USD, USDC/USD, CELO/USD, etc.)
- MANUAL — Admin-set prices for tokens without Chainlink coverage
- HARDCODED — Fixed prices for stablecoins (USDC = $1.00)
- DERIVED — Composite prices (e.g., eXOF = EUR/USD x 1/655.957)
Includes stale-price protection and automatic fallback: Chainlink -> Manual.
CompositeChainlinkFeed handles ETH-denominated feeds (weETH/ETH, wstETH/ETH) by multiplying token/ETH x ETH/USD to get a USD price.
Locus manages autonomous payments for rebalancing operations across all three chains.
- LocusClient: REST wrapper for
beta-api.paywithlocus.com - SpendingGuard: $50/tx limit, $500/day limit, $1 reserve, $25 approval threshold
- Allowlist: Only whitelisted vault addresses can receive payments
- Multi-chain agent: Detects drift on any chain -> pays via Locus on Base -> executes rebalance
- Audit trail: Every payment logged with real tx hashes and explorer links
- Wallet Connect: Connect Locus wallet on /locus page, send custom payments, withdraw to external wallet
Zyfai makes Darwin Protocol financially autonomous. It captures idle USDC from basket vaults, deploys it into DeFi yield protocols, and routes the earnings back to fund operations.
How it works:
User deposits 100 USDC into DARW-EU
-> 50 USDC swaps to WETH (growth exposure)
-> 50 USDC stays in vault (stable allocation)
-> Zyfai detects idle USDC
-> Pulls to Zyfai Safe (ERC-4337)
-> Deposits into Aave V3 on Base
-> Yield accrues as aBasUSDC
-> Harvest yield -> Locus wallet
-> Locus funds rebalancing on Base/Unichain/Celo
-> Loop repeats — self-sustaining
Agent cycle: 30-second loop. Scans all USDC-deposit baskets, prioritizes DARW-EU (showcase vault with permanent 50% USDC allocation), deposits idle capital, harvests yield, and triggers emergency top-ups if Locus wallet drops below $5.
darwin/
├── contracts/
│ ├── src/
│ │ ├── BasketVault.sol # Core vault — deposit, withdraw, rebalance
│ │ ├── DarwinSwapRouter.sol # Direct Uniswap V3 pool.swap() routing
│ │ ├── StrategyManager.sol # Strategy registration and drift thresholds
│ │ └── oracle/
│ │ ├── DarwinOracleV2.sol # Unified oracle (Chainlink + manual + derived)
│ │ └── CompositeChainlinkFeed.sol # token/ETH x ETH/USD composite
│ ├── script/ # Foundry deployment scripts (per chain)
│ └── test/
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ │ ├── page.tsx # ObsidianOS-inspired landing page
│ │ │ ├── agent/ # Agent dashboard
│ │ │ ├── basket/[id]/ # Basket detail page
│ │ │ ├── locus/ # Locus payment dashboard
│ │ │ ├── zyfai/ # Zyfai yield engine showcase
│ │ │ ├── audit/ # Combined audit trail
│ │ │ └── api/
│ │ │ ├── locus/ # Locus API (pay, withdraw, positions, audit)
│ │ │ └── zyfai/ # Zyfai API (status, vault-map, showcase)
│ │ ├── lib/
│ │ │ ├── agent/ # Agent runner (30s cycle, multi-chain)
│ │ │ ├── baskets.ts # All 12 baskets with addresses
│ │ │ ├── locus/ # LocusClient, SpendingGuard, audit
│ │ │ └── zyfai/ # YieldManager, config, storage, client
│ │ └── components/
│ │ ├── locus/ # Wallet connect, vault holdings, dashboard
│ │ └── zyfai/ # VaultMap, ShowcaseVault, EarnSpendLoop
│ └── public/images/chains/ # Chain logos (Base, Unichain, Celo, Locus, Zyfai)
├── .env.example # Environment template (no secrets)
├── CLAUDE.md # AI development instructions
└── README.md # This file
git clone https://github.com/dyonisos100/darwin.git
cd darwin
# Install Foundry dependencies
cd contracts && forge install && cd ..
# Install frontend dependencies
cd frontend && npm installcp .env.example .env
# Fill in your values:
# - DEPLOYER_PRIVATE_KEY / AGENT_PRIVATE_KEY
# - LOCUS_API_KEY
# - ZYFAI_API_KEYcd contracts && forge buildcd frontend && npm run dev
# -> http://localhost:3000
# Agent starts automatically with 30-second cycle| Route | Description |
|---|---|
/ |
Landing page — protocol overview, architecture, integrations |
/agent |
Agent dashboard — multi-chain status, activity feed, vault monitoring |
/basket/[id] |
Basket detail — composition, performance, deposit/withdraw |
/locus |
Locus dashboard — wallet connect, payments, vault holdings, withdraw |
/zyfai |
Zyfai yield engine — vault map, earn-spend loop, DARW-EU showcase |
/audit |
Combined audit trail — all Locus + Zyfai activity with tx hashes |
| Endpoint | Method | Description |
|---|---|---|
/api/agent/status |
GET | Agent state, vault statuses, recent activity |
/api/locus/status |
GET | Locus wallet balance and spending guard |
/api/locus/positions |
GET | On-chain token balances in all Base vaults |
/api/locus/withdraw |
POST | Swap vault tokens to USDC and send to recipient |
/api/locus/audit |
GET | Locus payment history |
/api/zyfai/status |
GET | Zyfai state (deposited, yield, APY) |
/api/zyfai/vault-map |
GET | All vaults with Zyfai intervention status |
/api/zyfai/showcase |
GET | DARW-EU deep dive (live on-chain data via Chainlink) |
/api/zyfai/redirect-status |
GET | USDC redirect pipeline (vault -> Safe -> Aave) |
| Token | Symbol | Address |
|---|---|---|
| USDC | USDC | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Wrapped ETH | WETH | 0x4200000000000000000000000000000000000006 |
| Coinbase Wrapped BTC | cbBTC | 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf |
| XRP (Universal) | uXRP | 0x2615a94df961278DcbC41Fb0a54fEc5f10a693aE |
| SOL (Universal) | uSOL | 0x9B8Df6E244526ab5F6e6400d331DB28C8fdDdb55 |
| Lido wstETH | wstETH | 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452 |
| EtherFi weETH | weETH | 0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A |
| AVAX (Bridged) | AVAX | 0x214C2cdbd6Ce71365478d80F2Dc0E3C39D0bC488 |
| Protocol | Contract (Base) | Usage |
|---|---|---|
| Uniswap V3 Factory | 0x33128a8fC17869897dcE68Ed026d694621f6FDfD |
Pool lookup for swaps |
| Aave V3 Pool | 0xA238Dd80C259a72e81d7e4664a9801593F98d1c5 |
USDC yield deposits |
| aBasUSDC | 0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB |
Yield-bearing aToken |
┌──────────────────────────────┐
│ User deposits into baskets │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Basket holds target weights │
│ (some weight in USDC) │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Zyfai captures idle USDC │
│ -> Deposits into Aave V3 │
│ -> Earns ~4-6% APY │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Yield harvested periodically │
│ -> Sent to Locus wallet │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Locus funds rebalancing ops │
│ on Base, Unichain, Celo │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Rebalanced baskets generate │
│ new idle capital -> loop repeats│
└──────────────────────────────┘
No manual funding required. The protocol pays for itself.
- No private keys or secrets in this repository. All sensitive values loaded from
.env(gitignored). .env.exampleprovided as a safe template.broadcast/directory (Foundry deployment logs) excluded from git.- SpendingGuard enforces rate limits on all autonomous payments.
- All contracts verified on their respective block explorers.
# Compile contracts
cd contracts && forge build
# Run Foundry tests
forge test -vvv
# Build frontend
cd frontend && npm run build
# Lint
cd frontend && npm run lintMIT
Built with Foundry, Next.js, Chainlink, Uniswap V3, Aave V3, Locus, and Zyfai.