Automated ETH Accumulation & Volatility Protection
๐ Built for the Contract.dev Early Builder Hackathon (November-December 2025)
Erebor is a DeFi vault designed to protect and grow your treasury automatically. Like the vast wealth of the Lonely Mountain, this vault manages your assets with precision.
Instead of keeping funds idle, Erebor keeps assets fully deployed in Aave V3 to earn lending interest. It utilizes Chainlink Automation and Chainlink Price Feeds to execute a "Buy Low, Sell High" strategy 24/7 without manual intervention.
- Take Profit: When ETH rises, it swaps to USDC to lock in gains.
- Buy the Dip: When ETH falls, it swaps back to ETH to accumulate more tokens.
The system relies on a central interaction between three protocols:
- Aave V3: Used for holding funds (ETH or USDC) to generate continuous yield.
- Uniswap V3/V2: Used for atomic swapping of assets during rebalancing.
- Chainlink:
- Price Feeds: Provides accurate, tamper-proof ETH/USD data.
- Automation: Triggers the
performUpkeepfunction to execute swaps automatically.
- ETH Mode (Accumulation): Funds are in Aave as WETH.
- Trigger: Price > High Threshold.
- Action: Withdraw WETH โ Swap to USDC โ Supply USDC to Aave.
- USDC Mode (Safety): Funds are in Aave as USDC.
- Trigger: Price < Low Threshold.
- Action: Withdraw USDC โ Swap to WETH โ Supply WETH to Aave.
- Smart Contracts: Solidity (v0.8.20)
- Framework: Foundry (Forge, Cast)
- Integrations:
- Chainlink Automation & Data Feeds
- Uniswap V3/V2 SwapRouter
- Aave V3 Pool
- Frontend: Next.js, Wagmi, RainbowKit
- Foundry installed.
- contract.dev.
-
Clone the repo:
git clone [https://github.com/0xunLin/Erebor.git](https://github.com/0xunLin/Erebor.git) cd Erebor -
Install dependencies:
forge install npm install
-
Set up environment: Create a
.envfile in the root directory:PRIVATE_KEY=your_private_key STAGENET_RPC_URL=your_stagenet_rpc_url
We use Stagenets on contract.dev to test interactions with simulated Aave and Uniswap contracts.