A smart yield optimization protocol on Solana that automatically rebalances funds between Jupiter Lend and Kamino Lend to maximize APY.
The Yield Aggregator is a Solana-based protocol designed to optimize lending yields. It intelligently monitors and compares the Annual Percentage Yield (APY) offered by Jupiter Lend and Kamino Lend, dynamically allocating user funds to the protocol offering the superior return.
This project leverages the Anchor Framework for on-chain logic and utilizes Surfpool for robust testing against real Mainnet forks, ensuring reliable Cross-Program Invocations (CPIs).
- Automated Yield Optimization: Continuously seeks the best lending rates.
- Dual-Protocol Integration: Seamlessly interacts with both Jupiter Lend and Kamino Lend.
- Smart Rebalancing: Allocates capital efficiently based on real-time performance metrics.
- Worker Bot Ready: Includes a
client_utilitysuite designed for off-chain worker bots to trigger rebalancing and maintenance tasks. - Real-World Testing: rigorous testing environment using Surfpool to simulate Mainnet conditions.
The project consists of three main components:
- On-Chain Program (
/programs): The core Anchor program that holds user funds and executes deposit/withdraw logic via CPIs to lending protocols. - Client Utilities (
/client_utility): TypeScript modules providing essential methods for interacting with the program. These are designed to be consumed by a future Worker Bot for automated operations. - Integration Tests (
/tests): Comprehensive test suite using Surfpool to validate logic against live protocol states.
Ensure you have the following installed:
- Node.js (v18+)
- Rust & Cargo
- Solana CLI
- Anchor Framework
- Surfpool (for testing)
-
Clone the repository:
git clone <repository-url> cd yield-aggregator
-
Install dependencies:
yarn install
-
Build the program:
anchor build
We use Surfpool to run tests against a forked Mainnet environment, allowing us to interact with the real Jupiter and Kamino programs.
-
Start Surfpool:
surfpool start --watch
-
Run Tests: In a separate terminal, run:
anchor test
yield-aggregator/
├── programs/ # Solana smart contracts (Anchor)
├── client_utility/ # Helper scripts for client/bot interactions
├── tests/ # Integration tests
├── migrations/ # Deploy scripts
└── Anchor.toml # Project configuration
The client_utility folder contains specialized scripts for the worker bot:
invokeClientWithdraw.ts: Handles user withdrawal requests.invokeRebalance.ts: Logic for checking APYs and rebalancing funds.helper-fns.ts: Common utilities for transaction management.
- Client Withdraw Feature: Complete the implementation of the client-side withdrawal logic.
- Bot Server: Develop a dedicated server to run the automation bot for rebalancing and maintenance.
- Liquidity Check & Trickle-In Strategy: Implement a feature to check protocol liquidity before withdrawals. If liquidity is insufficient, the system should "trickle in" funds bit by bit to the user's vault instead of failing or blocking the withdrawal.