Social DeFi vaults with AI orchestration on Monad Testnet
DelegateVault Prime is a decentralized vault management platform built on the Monad Testnet. It enables users to create and manage vaults with delegated control, supporting both ETH and ERC20 tokens. The platform features a modern web interface for seamless interaction with on-chain vault contracts.
- Dual-Mode Vaults - Support for both native ETH and ERC20 tokens
- Delegation System - Time-based delegation with expiration controls
- Fee Management - Configurable withdrawal fees (0-10%)
- Security - Pausable operations and reentrancy protection
- Real-time Data - Live vault metrics and position tracking
- Modern UI - Built with Next.js 15, React 19, and TailwindCSS
- Framework: Next.js 15.2.4 with App Router
- Language: TypeScript 5
- Styling: TailwindCSS 4.1.9 + shadcn/ui
- State: SWR for data fetching
- Icons: Lucide React
- Chain: Monad Testnet (Chain ID: 10143)
- Library: Viem (latest)
- Contracts: Solidity ^0.8.24
- Node.js 18+
- pnpm (recommended) or npm
- MetaMask or compatible Web3 wallet
- Clone the repository:
git clone <repository-url>
cd DelegateVault-Prime- Install dependencies:
pnpm install- Create environment file:
# Create .env.local file
NEXT_PUBLIC_DELEGATE_VAULT_ADDRESS=0x...
NEXT_PUBLIC_CHAIN_ID=10143- Run development server:
pnpm dev- Open http://localhost:3000 in your browser
pnpm build
pnpm startMain vault contract supporting deposits, withdrawals, and fee management.
Key Functions:
depositETH()- Deposit native ETH into the vaultdepositToken(uint256 amount)- Deposit ERC20 tokenswithdraw(uint256 shares)- Withdraw assets (with fee deduction)pause() / unpause()- Emergency controls (owner only)setFeeBps(uint16 newFeeBps)- Update withdrawal fee (0-1000 bps)
Manages time-based delegation permissions for vault operations.
Key Functions:
setDelegation(address vaultOwner, address delegate, uint256 expiresAt)revokeDelegation(address vaultOwner, address delegate)isDelegateActive(address vaultOwner, address delegate)
Factory contract for deploying new DelegateVault instances.
Key Functions:
deployVault(address underlying)- Deploy a new vaultallVaultsLength()- Get total number of deployed vaults
├── app/ # Next.js app router
│ ├── api/ # API routes
│ ├── vaults/ # Vault browsing pages
│ ├── onchain/ # Direct blockchain interaction
│ └── settings/ # Configuration
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── vault/ # Vault-specific components
│ └── onchain/ # Blockchain components
├── contracts/ # Solidity smart contracts
├── lib/ # Utilities and libraries
│ ├── abi/ # Contract ABIs
│ ├── chain/ # Chain configurations
│ └── *.ts # Helper utilities
├── hooks/ # Custom React hooks
└── scripts/ # Deployment scripts
GET /api/health- Service health checkGET /api/config- Chain and vault configurationGET /api/vaults- List all vaultsGET /api/vaults/[address]- Get vault detailsGET /api/vaults/[address]/positions- Get user positionsGET /api/onchain/vaults/[address]/metadata- On-chain metadataGET /api/onchain/vaults/[address]/events- Contract eventsPOST /api/actions/deposit- Execute depositPOST /api/actions/withdraw- Execute withdrawal
- Chain ID: 10143
- RPC URL: https://testnet-rpc.monad.xyz
- Explorer: https://testnet.monadexplorer.com
- Native Currency: MON
The application will automatically prompt you to add/switch to Monad Testnet when connecting your wallet.
Navigate to /vaults to see all available vaults. Click on any vault to view details and interact.
- Connect your wallet
- Select a vault
- Choose deposit amount
- Approve token (if ERC20)
- Confirm deposit transaction
- Navigate to vault detail page
- Enter shares to withdraw
- Confirm withdrawal (fees will be deducted)
Visit /onchain for advanced features:
- Build custom transactions
- View contract events
- Query vault metadata directly from chain
Vaults are stored in-memory by default. To add a vault:
- Set environment variable:
NEXT_PUBLIC_DELEGATE_VAULT_ADDRESS - Or use the
/onchaininterface to add vaults locally
The current implementation uses in-memory storage (lib/storage.ts). For production:
- Implement
StorageAdapterinterface - Replace
InMemoryStoragewith your database adapter (PostgreSQL, MongoDB, etc.)
Important: This is an MVP/prototype. Before production deployment:
- Replace minimal interfaces with OpenZeppelin contracts
- Implement persistent database storage
- Add signature validation for delegations
- Conduct professional security audits
- Enable proper error handling
- Add comprehensive testing
- Review and fix TypeScript/ESLint errors
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For issues and questions:
- Open an issue on GitHub
- Check existing documentation
- Review smart contract comments
Built for Monad Testnet | Powered by Next.js & Viem