AutoStack DCA
Non-custodial dollar cost averaging powered by MetaMask's ERC-7715 permissions and Envio's real-time indexing.
视频
描述
AutoStack DCA: Permission-Based Dollar Cost Averaging
Overview
AutoStack DCA is a non-custodial automated investment platform that leverages MetaMask's ERC-7715 Advanced Permissions to execute recurring token purchases on behalf of users. Combined with Envio's HyperIndex for real-time blockchain data, AutoStack delivers a seamless DCA experience with full transparency and user control.
* The Problem We're Solving
Dollar Cost Averaging (DCA) is one of the most effective long-term investment strategies - consistently buying assets at regular intervals regardless of price. However, implementing DCA in Web3 has historically required:
1. **Manual execution**: Users must remember to execute trades daily/weekly, leading to missed opportunities and inconsistent investing
2. **Custodial solutions**: Centralized services that hold user funds, introducing counterparty risk and defeating the purpose of self-custody
3. **Complex smart contract interactions**: Technical barriers that prevent mainstream adoption
* Our Solution
AutoStack DCA uses MetaMask's ERC-7715 Advanced Permissions to create a new paradigm: **permission-based automation**.
Instead of transferring funds to a third party, users grant a scoped permission directly through MetaMask:
- **Amount-limited**: "Spend up to X tokens"
- **Time-bounded**: "Over the next Y days"
- **Action-scoped**: "Only for this specific contract/action"
This permission model enables true non-custodial automation - the user's funds remain in their wallet until the exact moment of execution, and the permission enforces strict boundaries on what can be spent.
* How It Works
1. **Create Strategy**: User selects token pair, amount per execution, frequency (daily/weekly), and duration
2. **Grant Permission**: MetaMask prompts for ERC-7715 permission with clear spending limits
3. **Automated Execution**: Worker service monitors strategies and executes trades when due
4. **Real-time Tracking**: Envio indexes all events for instant dashboard updates
* Envio Integration
We use Envio's HyperIndex to power our analytics dashboard:
- **Real-time event indexing**: Every strategy creation, execution, and completion is indexed instantly
- **GraphQL API**: Frontend queries Envio for user strategies, execution history, and portfolio stats
- **Aggregated metrics**: Track total invested, average purchase price, and strategy performance
- **Multi-user support**: Global statistics on platform usage
Envio's HyperSync technology processes events at 10,000+ per second, ensuring our dashboard reflects the latest blockchain state without delays.
#### Technical Architecture
```
┌─────────────────────────────────────────────────────────────┐
│ USER INTERFACE │
│ Next.js 14 + Wagmi + TailwindCSS │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ METAMASK + ERC-7715 │
│ Permission request → User approval → Execution │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ AUTOSTACK DCA CONTRACT │
│ createStrategy() │ executeDCA() │ cancelStrategy() │
│ Events: StrategyCreated, DCAExecuted, etc. │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────────┐
│ WORKER SERVICE │ │ ENVIO HYPERINDEX │
│ Monitors & executes │ │ Real-time event indexing │
│ due strategies │ │ GraphQL API for frontend │
└─────────────────────────┘ └─────────────────────────────┘
```
Tech Stack
| Component | Technology |
|-----------|------------|
| Smart Contract | Solidity 0.8.20, Foundry, OpenZeppelin |
| Frontend | Next.js 14, TypeScript, Wagmi v2, Viem |
| Indexer | Envio HyperIndex, GraphQL |
| Worker | Node.js, ethers.js, node-cron |
| Chain | Base Sepolia (ERC-7715 supported) |
Key Features
- **True Non-Custody**: Funds stay in user's wallet until execution
- **Permission Boundaries**: ERC-7715 enforces spending limits at the protocol level
- **Flexible Strategies**: Daily or weekly execution, customizable amounts
- **Real-time Dashboard**: Envio-powered analytics with instant updates
- **Transparent Execution**: Every trade visible on-chain and in dashboard
- **Cancel Anytime**: Users can cancel strategies and receive remaining funds
Why This Matters
ERC-7715 Advanced Permissions represent a fundamental shift in how users interact with dApps. Instead of:
- Unlimited token approvals (security risk)
- Custodial deposits (counterparty risk)
- Manual transaction signing (friction)
Users can now grant **precise, bounded permissions** that enable automation while maintaining full control. AutoStack DCA demonstrates this powerful primitive in action.
- [x] DEX integration (Uniswap V3 swaps
Future Roadmap
- [ ] Multi-chain support (Arbitrum, Optimism, Polygon)
- [ ] Strategy templates and sharing
- [ ] Price-triggered DCA (buy only below X price)
- [ ] Mobile notifications via Telegram/Discord
- [ ] Portfolio performance vs lump-sum comparison
```
本次黑客松进展
Built entirely during the hackathon
技术栈
Next
ERC-7715
Envio-indexer
融资状态
Bootstraped