Bolarity Vault Router is a decentralized finance (DeFi) protocol built on Ethereum that provides flexible asset management and yield optimization solutions. The protocol automatically allocates user funds across different yield strategies through an intelligent routing system to achieve optimal asset allocation.
- Smart Routing System: Asset routing and management through the BolarityRouter contract
- Vault Management: BolarityVault provides standardized ERC4626 vault implementation with deposit, withdrawal, and yield distribution
- Strategy Management: Supports multiple yield strategies (e.g., Aave, Compound) with flexible switching and optimization
- Factory Pattern: VaultFactory provides standardized vault creation and management
- Registry System: Registry contract manages registration of all vaults and strategies
- Solidity 0.8.28: Smart contract development language
- Hardhat: Ethereum development environment and testing framework
- OpenZeppelin: Secure smart contract libraries
- TypeScript: Testing and configuration scripts
- Ethers.js: JavaScript library for Ethereum interaction
- Node.js >= 18.0.0
- npm or yarn
# Clone the repository
git clone https://github.com/your-org/BolarityVaultRouter.git
cd BolarityVaultRouter
# Install dependencies
npm installCompile all smart contracts:
npx hardhat compileClean cache and build files:
npx hardhat cleannpx hardhat testnpx hardhat test test/BolarityRouter.test.tsREPORT_GAS=true npx hardhat testnpx hardhat coveragenpx hardhat nodeUsing Hardhat Ignition:
npx hardhat ignition deploy ./ignition/modules/Deploy.tsnpx hardhat ignition deploy ./ignition/modules/Deploy.ts --network sepoliaBolarityVaultRouter/
├── contracts/ # Solidity smart contracts
│ ├── BolarityRouter.sol # Main router contract
│ ├── BolarityVault.sol # ERC4626 vault contract
│ ├── Registry.sol # Registry contract
│ ├── VaultFactory.sol # Vault factory contract
│ ├── interfaces/ # Interface definitions
│ ├── strategies/ # Strategy implementations
│ └── mocks/ # Mock contracts for testing
├── test/ # TypeScript test files
├── ignition/ # Hardhat Ignition deployment modules
│ └── modules/
├── scripts/ # Deployment and interaction script, as well as the SDK prototpye
├── artifacts/ # Compilation artifacts (auto-generated)
├── cache/ # Hardhat cache (auto-generated)
├── typechain-types/ # TypeScript type definitions (auto-generated)
└── hardhat.config.ts # Hardhat configuration
Main router contract responsible for managing deposits, withdrawals, and strategy routing.
deposit(): Deposit assets to specified vaultwithdraw(): Withdraw assets from vaultredeem(): Redeem vault shares
ERC4626-compliant vault contract managing user assets and yield distribution.
totalAssets(): Get total vault assetsconvertToShares(): Convert assets to sharesconvertToAssets(): Convert shares to assets
Registry contract maintaining registration information for all vaults and strategies.
registerVault(): Register new vaultregisterStrategy(): Register new strategygetVault(): Get vault information
Vault factory contract for creating and deploying new vault instances.
createVault(): Create new vaultdeployVault(): Deploy vault contract
npx hardhat consolenpx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS- All contracts utilize OpenZeppelin's security components
- Reentrancy protection (ReentrancyGuard)
- Emergency pause functionality (Pausable)
- Access control (Ownable)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License. See LICENSE file for details.
MIT License
Copyright (c) 2024 Bolarity Team
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.