A comprehensive DeFi platform featuring a factory-based vault system with ERC-4626 compliance, multi-protocol yield generation, and a modern web interface. Built with Rust smart contracts on Arbitrum Stylus and a Next.js frontend.
VaultFactory Contract: 0x4ba6482edb1d6a7a3b411a46b1573f427c81d0eb
Network: Arbitrum Sepolia Testnet
Contract Size: 18.6 KiB (19,027 bytes)
Note: Contract addresses are centrally managed in
frontend/constants/contractAddresses.ts
Smart Vault is a complete DeFi platform that allows users to:
- Create Personal Vaults: Each user gets their own ERC-4626 compliant vault
- Deploy to DeFi Protocols: Automatically invest in Aave, Compound, and Uniswap
- Manage Allocations: Configure how assets are distributed across protocols
- Earn Automated Yield: Passive income generation without manual management
- Transfer Vault Shares: ERC-20 compliant share tokens for maximum composability
In traditional finance and basic DeFi, users face several challenges:
- Idle Assets: Tokens sitting in wallets earn nothing, losing value to inflation
- Complex Yield Farming: Manually managing multiple DeFi protocols is time-consuming and risky
- Fragmented Experience: Each DeFi protocol has different interfaces and standards
- High Gas Costs: Frequent manual rebalancing and strategy adjustments are expensive
- Technical Barriers: Average users can't easily access advanced DeFi strategies
Traditional asset management forces users to choose between:
- Keeping assets idle (no returns, inflation risk)
- Manually managing complex DeFi strategies (time-consuming, risky, expensive)
Smart Vaults automatically invest your deposited assets using pre-programmed strategies to generate yield while maintaining liquidity and standardization.
Think of it as: Instead of manually managing a complex investment portfolio, you deposit your tokens into an automated robo-advisor that handles all the technical DeFi operations for you.
Users can deposit tokens (like ETH, USDC, or any ERC20 token) into the vault.
In return, the vault gives users "shares" that represent their ownership of the vault. (If you own 10% of the shares, you own 10% of the vault's assets.)
These shares are ERC-20 tokens, meaning you can:
- Transfer them to others (they become part-owners of the vault)
- Use them in any DeFi protocol that accepts ERC-20 tokens
- Check your balance using standard
balanceOfcalls
Instead of letting assets just sit idle, the vault can allocate them into strategies like:
- Lending protocols (Aave, Compound) to earn interest
- Liquidity pools (Uniswap, Curve) to earn fees
- Yield farming strategies (Yearn-style optimizations) to earn rewards
- Vault stakes assets in protocols that give out governance/reward tokens (like COMP, CRV, or farm incentives)
- Auto-sells or compounds those rewards back into the vault to boost returns
As the strategies generate yield, the value of each share in the vault increases. So users earn passively without doing the complex DeFi interactions themselves.
At any time, users can redeem their shares back for the underlying assets + the yield they've earned.
Alice has 100 DAI sitting in her wallet.
- Her DAI earns 0% interest
- Over time, inflation reduces its purchasing power
- She has to manually find and manage yield opportunities
- Result: Alice's money loses value over time
Alice deposits 100 DAI into a Smart Vault.
- The vault automatically lends her DAI to Aave at 5% APY
- Additionally, it stakes a portion in other yield-generating protocols
- After 1 year, her 100 DAI becomes ~105 DAI automatically
- Result: Alice earns passive income without any manual work
Bob deposits 1000 USDC into an Index Smart Vault.
- The vault spreads his USDC across multiple strategies:
- 40% to Aave lending (4% APY)
- 30% to Compound lending (3.5% APY)
- 20% to liquidity pools (8% APY)
- 10% to staking protocols (6% APY)
- Bob gets diversified exposure with a single deposit
- Result: Bob achieves portfolio diversification and risk management automatically
ERC-4626 is the universal standard for tokenized vaults, ensuring:
- Interoperability: All ERC-4626 vaults work the same way across different platforms
- Composability: DeFi protocols can easily integrate with any ERC-4626 vault
- User Experience: Wallets and dApps can display vault balances consistently
- Developer Experience: One standard interface for all vault operations
- Standardized Deposits/Withdrawals: Same interface across all vaults
- Share Tokens: Receive ERC-20 tokens representing your vault ownership
- Automatic Accounting: Vault handles all the complex math for you
- Universal Compatibility: Works with any DeFi application that supports ERC-4626
At its core, a Vault behaves like an ERC20 token contract.
Why? Because when you deposit assets, the Vault issues you shares, and those shares are just ERC20 tokens.
That means you can:
- Transfer them: Send your shares to a friend, now they own part of the vault
- Check balances: Use standard ERC20 calls (
balanceOf) to see your share balance - Use them in DeFi: Trade, lend, or use your vault shares like any other token
- Deposit Process: Users deposit underlying assets (ETH, USDC, etc.) and receive vault shares
- Share Representation: Each share represents a proportional ownership of the vault's total assets
- Yield Distribution: As the vault earns yield, the value of each share increases automatically
- Withdrawal Process: Users redeem shares for their proportional share of the vault's current value
- Standardized Interface: All ERC-4626 vaults use the same functions (
deposit,withdraw,mint,redeem) - ERC-20 Compatibility: Vault shares are fully compatible with all ERC-20 functions and can be used in any DeFi protocol
- Automated Yield Generation: Your assets work for you 24/7
- Standardized Interface: Same experience across all ERC-4626 vaults
- Risk Management: Diversified strategies reduce single-point-of-failure risk
- Gas Efficiency: Batch operations reduce transaction costs
- User-Friendly: No technical knowledge required to earn DeFi yields
- Composable: Works seamlessly with other DeFi protocols
- Transparent: All operations are on-chain and verifiable
- DeFi Beginners: Easy entry into yield farming without complexity
- Passive Investors: Set-and-forget investment strategies
- Institutional Users: Professional asset management with DeFi yields
- DAO Treasuries: Automated treasury management for organizations
- Retail Savers: Better returns than traditional savings accounts
- DeFi Developers: Building on standardized vault infrastructure
- VaultFactory: Lightweight factory that deploys individual UserVault contracts
- UserVault: ERC-4626 compliant vault with direct DeFi protocol integration
- Admin System: Multi-admin management with protocol address configuration
- User Registration: On-chain user profiles with username and bio
- User Dashboard: Complete vault management interface with 5 main tabs
- Admin Panel: Protocol management and platform monitoring
- Real-time Integration: Live data from smart contracts
- Responsive Design: Works on desktop and mobile
SmartVault/
βββ README.md # This comprehensive project overview
βββ smartvault-contract/ # Rust smart contracts for Arbitrum Stylus
β βββ README.md # Contract documentation and deployment
β βββ src/ # Rust source code
β β βββ lib.rs # Main contract exports
β β βββ vault_factory.rs # Factory contract for deploying vaults
β β βββ user_vault.rs # Individual user vault implementation
β β βββ tests.rs # Test suite
β βββ Cargo.toml # Rust dependencies
β βββ gig1.json # Deployed contract ABI
β βββ user_vault_abi.json # UserVault contract ABI
βββ frontend/ # Next.js frontend application
βββ README.md # Frontend documentation
βββ app/ # Next.js app directory
β βββ page.tsx # Landing page
β βββ user-acct/ # User dashboard
β βββ admin/ # Admin panel
βββ components/ # React components
β βββ useracct-comp/ # User account components
β βββ admin-comp/ # Admin components
β βββ Header/ # Navigation
β βββ Footer/ # Site footer
βββ hooks/ # Custom React hooks
β βββ useVaultFactory.ts # VaultFactory integration
β βββ useUserVault.ts # UserVault integration
βββ constants/ # Contract ABIs and addresses
βββ package.json # Node.js dependencies
cd smartvault-contract
cargo check
source .env
cargo stylus deploy -e $(TESTNET_RPC_URL) --no-verify --private-key $(PRIVATE_KEY)
cargo stylus export-abi --json --output gig1.jsoncast send --rpc-url $(TESTNET_RPC_URL) --private-key $(PRIVATE_KEY) 0x4ba6482edb1d6a7a3b411a46b1573f427c81d0eb "init()"cd frontend
npm install
npm run dev- User Dashboard: Navigate to
/user-acctafter connecting wallet - Admin Panel: Click "SmartVault" in footer (admin access required)
- Language: Rust
- Platform: Arbitrum Stylus
- Standard: ERC-4626 compliant
- Features: Gas-optimized, modular architecture, automated yield strategies
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- Web3: Wagmi v2 + Viem
- State Management: React hooks
Group 9
- Adesanoye Samson
- Olamide Adebara
- Babalola Taiwo J
Alice has 100 DAI sitting in her wallet. She remembers her childhood piggy bank - it kept her money safe but never made it grow. If she put in $100, she'd only ever get $100 back.
Alice finds a DeFi Smart Vault that promises: "Deposit your 100 DAI here. I won't just keep it safe - I'll put it to work." Curious, she deposits her DAI.
The vault automatically:
- Lends Alice's DAI to Aave, earning 5% interest
- Stakes a portion in other yield-generating protocols
- Manages all operations without Alice lifting a finger
When Alice deposits 100 DAI:
- She receives 100 VaultShares (ERC-20 tokens representing her ownership)
- If the vault grows, each share becomes worth more
- A year later, her 100 VaultShares are worth 105 DAI
- She can redeem her shares anytime for the current value
Without ERC-4626, every vault would be different and confusing. With ERC-4626:
- Alice can use any vault the same way
- Wallet apps easily show her balance and returns
- It's like having one universal ATM card that works everywhere
- Smart Contract README: Technical implementation details, API reference, and deployment guide
- Frontend README: Frontend setup, component documentation, and user interface guide
- 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
MIT License - see individual component READMEs for specific licensing information.
- Documentation: Check the component-specific READMEs
- Issues: Report bugs via GitHub Issues
- Discussions: Join project discussions for questions
Smart Vault - Your Digital Piggy Bank That Actually Grows Your Money π¦π°π¦π°