Real-time activity dashboard for Yearn Finance V3 vaults
- Real-time Activity Feed: Live feed of deposits and withdrawals across all tracked vaults
- Protocol Statistics: Overview of all tracked Yearn V3 vaults
- User Activity: Track individual user transactions and positions
- Vault Details: Information about each tracked vault
- Next.js 15 - React framework with App Router
- TypeScript - Type safety
- TailwindCSS - Utility-first CSS framework
- Envio HyperIndex - Blazing-fast blockchain indexer
- GraphQL - Query language for the Envio API
- Node.js 18+ and pnpm installed
- Envio Indexer running locally or hosted
pnpm installCopy the example environment file:
cp .env.local.example .env.localEdit .env.local with your configuration:
# For local development with Envio
ENVIO_GRAPHQL_URL=http://localhost:8080/v1/graphql
# For production (hosted Envio)
# ENVIO_GRAPHQL_URL=https://indexer.hyperindex.xyz/YOUR_INDEXER_ID/v1/graphqlIn a separate terminal, start the Envio indexer:
pnpm envio devThis will:
- Start the indexer and begin syncing blockchain data
- Launch Hasura GraphQL console at http://localhost:8080
Wait for the indexer to sync some data before proceeding.
pnpm devOpen http://localhost:3000 in your browser.
├── app/ # Next.js 15 App Router
│ ├── page.tsx # Homepage with dashboard
│ ├── activity/ # Activity feed page
│ ├── vaults/ # Vaults overview page
│ └── user/[address]/ # Individual user page
├── components/
│ ├── layout/ # Header, Footer
│ ├── activity/ # Activity-related components
│ └── shared/ # Reusable components
├── lib/
│ └── envio/ # Envio integration
│ ├── client.ts # GraphQL client
│ ├── queries.ts # GraphQL queries
│ ├── utils.ts # Utility functions
│ └── constants.ts # Vault addresses
└── config.yaml # Envio indexer configuration
The following Yearn V3 vaults are currently indexed on Ethereum Mainnet:
- USDC Vault:
0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204 - DAI Vault:
0x028eC7330ff87667b6dfb0D94b954c820195336c - USDT Vault:
0x310B7Ea7475A0B449Cfd73bE81522F1B88eFAFaa - USDS Vault:
0x182863131F9a4630fF9E27830d945B1413e347E8 - CRVUSD Vault:
0xBF319dDC2Edc1Eb6FDf9910E39b37Be221C8805F - WETH Vault:
0xc56413869c6CDf96496f2b1eF801fEDBdFA7dDB0
The app currently works with basic event data, but you can add more fields to unlock additional features:
To enable Etherscan links, add the transactionHash field:
// In your Envio handler
DepositEvent.loader({
requiredEntities: [],
handler: ({ event, context }) => {
context.Deposit.set({
id: event.chainId + "_" + event.block.number + "_" + event.logIndex,
transactionHash: event.transaction.hash, // Enables Etherscan links
blockTimestamp: event.block.timestamp, // Accurate time display
blockNumber: event.block.number, // Better sorting
sender: event.params.sender,
owner: event.params.owner,
assets: event.params.assets,
shares: event.params.shares,
vaultAddress: event.srcAddress,
});
},
});See ENVIO_SCHEMA_GUIDE.md for a comprehensive list of fields you can add:
- Transaction context: timestamps, gas costs, block data
- Financial data: USD values, share prices, TVL
- User analytics: position tracking, ROI calculations
- Enhanced UX: ENS names, vault symbols
- Performance metrics: APY, earnings, strategy data
To track additional vaults:
- Add the vault address to
config.yamlunder thecontractssection - Restart the Envio indexer
- Add the vault to
lib/envio/constants.ts
The app is configured to use Aeonik font (Yearn's brand font). To add the actual fonts:
- Download Aeonik from cotypefoundry.com
- Place
.woff2files inpublic/fonts/ - Update
app/fonts.tswith the correct paths
The app uses Yearn's official brand colors defined in tailwind.config.ts:
- Yearn Blue:
#0675F9 - Good ol' Grey scale (100-900)
- Secondary colors: Metaverse Sunset, Disco Salmon, Tokyo Party, Up Only Green
The app uses Next.js Server Components for data fetching. You can also create API routes:
// app/api/activity/route.ts
import { getRecentActivity } from '@/lib/envio/queries';
export async function GET() {
const data = await getRecentActivity(50);
return Response.json(data);
}- Push your code to GitHub
- Import the project in Vercel
- Add environment variables:
ENVIO_GRAPHQL_URL: Your hosted Envio endpoint
- Deploy
For production, use Envio's hosted service:
- Push your indexer to GitHub
- Connect to Envio's hosted service
- Get your production GraphQL endpoint
- Update environment variables
- Server-side caching: 30-second revalidation for activity feeds
- Client-side caching: Use SWR or TanStack Query for real-time updates
- Incremental Static Regeneration: Pages automatically update
- Make sure the Envio indexer is running:
pnpm envio dev - Check that
ENVIO_GRAPHQL_URLis correctly set in.env.local - Verify the indexer has synced data by visiting http://localhost:8080
- Wait for the indexer to sync blockchain data
- Check the Hasura console to verify data is being indexed
- Ensure the tracked vaults have recent transactions
- Check that the GraphQL endpoint is accessible
- Verify the Envio indexer is running
- Review error messages in the browser console
MIT