AI-Powered Autonomous Portfolio Management Dashboard on Hedera
ReVaultron frontend provides a comprehensive dashboard for managing AI-powered cryptocurrency portfolios on Hedera. Create vaults, configure autonomous agents, monitor real-time volatility, and track automatic rebalancing through an intuitive interface.
Key Features:
- π MetaMask wallet integration for Hedera testnet
- π Real-time portfolio monitoring with live price feeds
- π€ AI agent activity tracking and status monitoring
- β‘ Automated rebalancing notifications
- πΌ Multi-token vault management
- π Historical volatility and performance analytics
frontend/
βββ src/
β βββ components/ # React components
β β βββ dashboard/
β β β βββ Dashboard.tsx # Main dashboard view
β β β βββ PortfolioOverview.tsx # Value & allocation summary
β β β βββ VolatilityMonitor.tsx # Real-time volatility display
β β β βββ AllocationChart.tsx # Visual allocation breakdown
β β βββ vault/
β β β βββ VaultCreationWizard.tsx # 4-step vault setup
β β β βββ TokenSelector.tsx # Token selection interface
β β β βββ AllocationSlider.tsx # Allocation percentage controls
β β β βββ DepositInterface.tsx # Deposit/withdrawal UI
β β βββ agents/
β β β βββ AgentActivityFeed.tsx # Live HCS message stream
β β β βββ AgentAuthorizationCard.tsx
β β β βββ RebalancingProgress.tsx # Live rebalancing tracker
β β βββ wallet/
β β β βββ WalletConnect.tsx # Multi-wallet connection
β β β βββ AccountDisplay.tsx # Account info display
β β βββ shared/
β β βββ LoadingSpinner.tsx
β β βββ ErrorBoundary.tsx
β β βββ TransactionToast.tsx
β βββ hooks/
β β βββ useHedera.ts # Hedera client management
β β βββ useHCS.ts # HCS topic subscriptions
β β βββ useVault.ts # Vault contract interactions
β β βββ useAgents.ts # Agent status tracking
β β βββ usePortfolio.ts # Portfolio calculations
β βββ lib/
β β βββ hedera/
β β β βββ client.ts # Hedera SDK wrapper
β β β βββ hcs.ts # HCS message handling
β β β βββ hts.ts # Token transfers
β β β βββ contracts.ts # Smart contract ABIs
β β βββ wallet/
β β β βββ hashpack.ts # HashPack integration
β β β βββ blade.ts # Blade wallet integration
β β βββ utils/
β β βββ formatting.ts # Number/date formatting
β β βββ calculations.ts # Portfolio math
β β βββ constants.ts # Contract addresses, etc.
β βββ types/
β β βββ vault.ts # Vault data types
β β βββ agent.ts # Agent message types
β β βββ portfolio.ts # Portfolio types
β βββ stores/
β β βββ walletStore.ts # Wallet state (Zustand)
β β βββ vaultStore.ts # Vault state
β β βββ agentStore.ts # Agent activity state
β βββ App.tsx
β βββ main.tsx
βββ public/
β βββ assets/
β β βββ agent-icons/ # Agent avatars
β βββ index.html
βββ package.json
βββ tsconfig.json
βββ vite.config.ts
βββ tailwind.config.js
Node.js >= 18.0.0
npm >= 9.0.0
MetaMask wallet extension# Clone the repository
git clone https://github.com/yourusername/ReVaultron-hedera
cd ReVaultron-hedera/frontend
# Install dependencies
npm install
# Copy environment template
cp .env.example .env.local# .env.local
# Network Configuration
NEXT_PUBLIC_HEDERA_NETWORK=testnet
NEXT_PUBLIC_CHAIN_ID=296 # Hedera Testnet EVM chain ID
# Contract Addresses (Deployed on Hedera Testnet)
NEXT_PUBLIC_VAULT_FACTORY_ADDRESS=0x...
NEXT_PUBLIC_VOLATILITY_INDEX_ADDRESS=0x...
NEXT_PUBLIC_REBALANCE_EXECUTOR_ADDRESS=0x...
# Agent System (Local development)
NEXT_PUBLIC_AGENT_BASE_URL=http://localhost # Agent server base URL
# Pyth Network Configuration
NEXT_PUBLIC_PYTH_CONTRACT=0x...
NEXT_PUBLIC_PYTH_PRICE_FEED_HBAR=0x...# Start development server
npm run dev
# Open browser at http://localhost:3000# Create optimized production build
npm run build
# Start production server
npm startMetaMask Integration for Hedera Testnet:
// Hedera Testnet Configuration
const HEDERA_TESTNET = {
chainId: '0x128', // 296 in decimal
chainName: 'Hedera Testnet',
rpcUrls: ['https://testnet.hashio.io/api'],
nativeCurrency: {
name: 'HBAR',
symbol: 'HBAR',
decimals: 18,
},
blockExplorerUrls: ['https://hashscan.io/testnet'],
};Key Features:
- Automatic network detection and switching
- Custom network addition to MetaMask
- Account balance display in HBAR
- Transaction signing and confirmation
Create and manage autonomous vaults:
- Token selection (HBAR, USDC, ERC20)
- Allocation percentage controls
- Volatility threshold configuration
- Deposit and withdrawal interfaces
- Real-time balance tracking
Track autonomous agent activities:
- Volatility Advisor: AI-powered market analysis
- Volatility Updater: On-chain volatility updates
- Allocation Strategist: Portfolio optimization
- Rebalance Checker: Portfolio drift detection
- Rebalance Executor: Automatic rebalancing
Real-time status updates via polling (10s intervals) or WebSocket connections.
Pyth Network Integration:
- Real-time HBAR/USD price feeds
- Confidence intervals
- Price history tracking
- Volatility calculations
<MetricCard
title="Total Deposited"
value="$2,200"
change={2.5}
icon={DollarSign}
/><VolatilityMonitor
threshold={30}
priceFeedId={PYTH_HBAR_USD}
/><AgentActivityFeed /><HBARDepositModal
open={open}
onOpenChange={setOpen}
vaultAddress={vaultAddress}
/>
<HBARWithdrawModal
open={open}
onOpenChange={setOpen}
vaultAddress={vaultAddress}
/><ERC20DepositModal
vaultAddress={vaultAddress}
tokenAddress={tokenAddress}
/>User clicks "Connect Wallet"
β
Frontend checks for MetaMask
β
Request network switch to Hedera Testnet
β
User approves connection
β
Frontend receives wallet address
β
Check for existing vault
β
Load dashboard with vault data
Dashboard loads
β
Start polling agent status endpoints (every 10s)
β
Agent executes task
β
Agent stores result in backend
β
Frontend fetches updated status
β
Extract latest result data
β
Generate activity for feed
β
Update UI with new information
Volatility Updater runs (every 30s)
β
Calls Volatility Advisor for AI recommendation
β
Updates on-chain volatility
β
Rebalance Checker detects drift > 5%
β
Calls Allocation Strategist for target allocation
β
Triggers Rebalance Executor
β
Executes swap on SaucerSwap
β
Frontend displays completion notification
// tailwind.config.js
export default {
darkMode: ['class'],
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
border: 'hsl(var(--border))',
primary: 'hsl(var(--primary))',
// ... shadcn/ui color system
},
},
},
plugins: [require('tailwindcss-animate')],
};// next.config.js
const nextConfig = {
reactStrictMode: true,
webpack: (config) => {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
};
return config;
},
};{
"dependencies": {
"next": "^14.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"wagmi": "^2.5.0",
"viem": "^2.7.0",
"@tanstack/react-query": "^5.22.0",
"recharts": "^2.12.0",
"lucide-react": "^0.263.1",
"date-fns": "^3.3.1",
"clsx": "^2.1.0",
"tailwind-merge": "^2.2.1"
},
"devDependencies": {
"@types/react": "^18.2.55",
"typescript": "^5.3.3",
"tailwindcss": "^3.4.1",
"eslint": "^8.56.0",
"prettier": "^3.2.5"
}
}Solution:
- Open MetaMask
- Go to Settings β Networks β Add Network
- Enter Hedera Testnet details:
- Network Name:
Hedera Testnet - RPC URL:
https://testnet.hashio.io/api - Chain ID:
296 - Currency Symbol:
HBAR
- Network Name:
Solution:
- Verify agent servers are running (
npm startin agents directory) - Check agent endpoints return data:
curl http://localhost:4001/status - Verify CORS is enabled for your frontend URL
- Check browser console for network errors
Solution:
- Ensure wallet has sufficient HBAR for gas fees (~0.1 HBAR minimum)
- Check vault has tokens for withdrawal operations
- Verify token associations are complete
Solution:
- Verify Pyth contract address in environment variables
- Check price feed ID is correct
- Test Pyth endpoint:
curl https://hermes.pyth.network/v2/updates/price/latest?ids[]=0x...
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel --prod
# Configure environment variables in Vercel dashboard- Build Command:
npm run build - Output Directory:
.next - Install Command:
npm install
- Never store private keys - All transactions use MetaMask signer
- Validate all inputs - Amount validation, address checks
- Verify contract addresses - Hardcoded in environment variables
- Rate limit API calls - Prevent abuse of backend endpoints
- Sanitize user inputs - Prevent XSS attacks
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.
Built with β€οΈ for the Hedera ecosystem