RecoveryDex is a comprehensive DeFi platform that combines smart contract aggregation with an intuitive React frontend. The project implements intelligent token swapping on the Harmony network, allowing users to split large transactions (amountIn) into multiple smaller operations using intermediate tokens like JEWEL, SONIC, or VIPER to minimize slippage.
- Multi-Split Aggregation: Automatically splits large trades into smaller chunks to reduce slippage
- Router Optimization: Finds the best routes across multiple DEX routers
- Intermediate Token Support: Uses whitelisted intermediate tokens for optimal routing
- React Frontend: Modern, responsive web interface with wallet integration
- Documentation Site: Comprehensive VitePress-powered documentation
- Harmony Network: Optimized for Harmony blockchain with WONE support
- AggregatorMultiSplit.sol: Core contract implementing multi-split functionality with router and intermediate token whitelisting
- BandOracle/: Price oracle integration using Band Protocol
- interfaces/: Contract interfaces for external integrations
- IUniswapV2Router02.sol: Uniswap V2 router interface
- IWETH.sol: Wrapped ETH interface
- lib/: Utility libraries for routing and swap calculations
- RouterLib.sol: Route optimization and slippage calculation functions
- Mocks/: Test contracts for development and testing
- components/: React components including swap interface, admin panels, and notifications
- pages/: Application pages (Home, Liquidity, Transactions, Settings, Admin)
- hooks/: Custom React hooks for blockchain interactions
- services/: API services and blockchain integration
- web3/: Web3 configuration and wallet connection (AppKit)
- context/: React context providers for state management
- deploy.js: Smart contract deployment script
- simulate.js: Swap simulation and testing
- benchmarkAggregator.mjs: Performance benchmarking
- verify.js: Contract verification on block explorers
- AggregatorMultiSplit.test.js: Comprehensive contract tests
- fixtures.js: Test data and mock setups
- VitePress-powered documentation site
- Multi-language support (English, Portuguese)
- API documentation, architecture guides, and setup instructions
Install project dependencies:
# Install smart contract dependencies
npm install
# Install frontend dependencies (if running separately)
cd src && npm installDeploy contracts to Harmony network:
# Deploy to Harmony mainnet
npm run deploy
# Deploy to Harmony testnet
npm run deploy:testnetRun contract simulations:
# Simulate on mainnet
npm run simulate
# Simulate on testnet
npm run simulate:testnetRun tests:
npm run testThe frontend is configured to run with Vite and includes:
# Start development server (configured in vite.config.js)
npm run dev # Runs on port 3007 by default
# Build for production
npm run build
# Preview production build
npm run previewGenerate and serve documentation:
cd docs
npm run dev # Development server
npm run build # Build static site
npm run preview # Preview built siteWONE_ADDRESS: Wrapped ONE token addressROUTERS: Comma-separated list of DEX router addressesINTERMEDIATES: Comma-separated list of intermediate token addressesFEE_BPS: Fee in basis points (e.g., 25 = 0.25%)VITE_PORT: Frontend development portVITE_API_GATEWAY_URL: API gateway URL for backend services
The project is configured for Harmony network in hardhat.config.js with support for:
- Harmony mainnet (chainId: 1666600000)
- Harmony testnet
- Custom block explorer integration
- Contract verification setup
RecoveryDex follows a modular architecture:
- Smart Contract Layer: Handles on-chain logic, routing, and swapping
- Frontend Layer: React-based user interface with Web3 integration
- Documentation Layer: VitePress site for comprehensive documentation
- Testing Layer: Comprehensive test suite for contracts and frontend
Contributions are welcome! Please feel free to submit issues or pull requests for improvements and bug fixes.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License. See the LICENSE.md file for details.
- Documentation: Comprehensive guides and API references in
/docs - Frontend Demo: React application showcasing the aggregator
- Smart Contracts: Deployed on Harmony network with verification