Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Updated #35

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added documentation/.gitbook/assets/HH-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/.gitbook/assets/Hyper Harvest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/.gitbook/assets/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 7 additions & 9 deletions documentation/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
cover: https://gitbookio.github.io/onboarding-template-images/header.png
cover: >-
https://images.unsplash.com/photo-1471268762677-cb5179779bfe?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHw2fHxoYXJ2ZXN0fGVufDB8fHx8MTcyNTc4MDg1N3ww&ixlib=rb-4.0.3&q=85
coverY: 0
layout:
cover:
Expand All @@ -17,12 +18,9 @@ layout:
visible: true
---

# Welcome
# 🌽 Hyper Harvest

Welcome to the GitBook Starter Template! Here you'll get an overview of all the amazing features GitBook offers to help you build beautiful, interactive documentation.

You'll see some of the best parts of GitBook in action — and find help on how you can turn this template into your own.

### Jump right in

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Getting Started</strong></td><td>Create your first site</td><td><a href=".gitbook/assets/1.png">1.png</a></td><td></td><td><a href="overview/introduction/">introduction</a></td></tr><tr><td><strong>Basics</strong></td><td>Learn the basics of GitBook</td><td><a href=".gitbook/assets/2.png">2.png</a></td><td></td><td><a href="broken-reference">Broken link</a></td></tr><tr><td><strong>Publish your docs</strong></td><td>Share your docs online</td><td><a href=".gitbook/assets/3.png">3.png</a></td><td></td><td><a href="overview/getting-started/">getting-started</a></td></tr></tbody></table>
HyperHarvest is an innovative cross-chain yield aggregator that maximizes USDC returns across Arbitrum Sepolia and Optimism Sepolia testnets. Our platform stands out through its use of private, encrypted yield optimization strategies, providing a unique competitive edge in the DeFi landscape .\
\
Start Harvesting :[ HyperHarvest](https://hyperharvest.vercel.app/)\
XMTP Bot (Converse App ) : [0x1E7a0E69B39c2A2f7d0D6a0cF4A1D4fCaD8f04ED](../0x1E7a0E69B39c2A2f7d0D6a0cF4A1D4fCaD8f04ED)
39 changes: 18 additions & 21 deletions documentation/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
# Table of contents

* [Welcome](README.md)
* [🌽 Hyper Harvest](README.md)

## Overview

* [Introduction](overview/introduction/README.md)
* [Project Overview](overview/introduction/project-overview.md)
* [Key Features](overview/introduction/key-features.md)
* [Why This Matters](overview/introduction/why-this-matters.md)
* [🍀 Project Overview](overview/introduction/project-overview.md)
* [🪶 Key Features](overview/introduction/key-features.md)
* [🕰️ Why This Matters](overview/introduction/why-this-matters.md)
* [Getting Started](overview/getting-started/README.md)
* [Prerequisites](overview/getting-started/prerequisites.md)
* [Installation](overview/getting-started/installation.md)
* [Quick Start Guide](overview/getting-started/quick-start-guide.md)
* [🥨 Prerequisites](overview/getting-started/prerequisites.md)
* [🪻 Installation](overview/getting-started/installation.md)
* [📒 Quick Start Guide](overview/getting-started/quick-start-guide.md)

## Basics

* [Architecture](basics/architecture/README.md)
* [System Overview](basics/architecture/system-overview.md)
* [HyperHarvest Smart Contract](basics/architecture/hyperharvest-smart-contract.md)
* [Cross Chain Communication](basics/architecture/cross-chain-communication.md)
* [👨‍💼 System Overview](basics/architecture/system-overview.md)
* [🎛️ HyperHarvest Smart Contract](basics/architecture/hyperharvest-smart-contract.md)
* [⛓️ Cross Chain Communication](basics/architecture/cross-chain-communication.md)
* [Core Components](basics/core-components/README.md)
* [HyperHarvest Vault](basics/core-components/hyperharvest-vault.md)
* [Private Strategy Mechanism](basics/core-components/private-strategy-mechanism.md)
* [Lit Protocol Integration](basics/core-components/lit-protocol-integration.md)
* [XMTP Integration](basics/core-components/xmtp-integration.md)
* [Web3 Auth Integration](basics/core-components/web3-auth-integration.md)
* [Envio Integration](basics/core-components/envio-integration.md)
* [User Guide](basics/user-guide/README.md)
* [Depositing Funds](basics/user-guide/depositing-funds.md)
* [Withdrawing Funds](basics/user-guide/withdrawing-funds.md)
* [Yield Monitoring](basics/user-guide/yield-monitoring.md)
* [Understanding Notifications](basics/user-guide/understanding-notifications.md)
* [🛬 HyperHarvest Vault](basics/core-components/hyperharvest-vault.md)
* [📠 Private Strategy Mechanism](basics/core-components/private-strategy-mechanism.md)
* [🔗 Chainlink CCIP Integration](basics/core-components/chainlink-ccip-integration.md)
* [🔥 Lit Protocol Integration](basics/core-components/lit-protocol-integration.md)
* [📧 XMTP Integration](basics/core-components/xmtp-integration.md)
* [🕸️ Web3 Auth Integration](basics/core-components/web3-auth-integration.md)
* [📇 Envio Integration](basics/core-components/envio-integration.md)
* [🙎‍♂️ User Guide](basics/user-guide.md)
* [Developer Guide](basics/developer-guide/README.md)
* [Setting Up the Development Environment](basics/developer-guide/setting-up-the-development-environment.md)
* [Smart Contract Interaction](basics/developer-guide/smart-contract-interaction.md)
Expand Down
10 changes: 1 addition & 9 deletions documentation/basics/architecture/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# Architecture

GitBook has a powerful block-based editor that allows you to seamlessly create, update, and enhance your content.\
\


### Writing content

GitBook offers a range of block types for you to add to your content inline — from simple text and tables, to code blocks and more. These elements will make your pages more useful to readers, and offer extra information and context.

Either start typing below, or press `/` to see a list of the blocks you can insert into your page.
Proceed to System Overview ->
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Cross Chain Communication
---
cover: >-
https://images.unsplash.com/photo-1453683685760-b8db0bbb8dc2?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHwxfHxjaGFpbnxlbnwwfHx8fDE3MjU3ODI2Mjh8MA&ixlib=rb-4.0.3&q=85
coverY: 0
---

# ⛓️ Cross Chain Communication

We use Chainlink's CCIP (Cross-Chain Interoperability Protocol) to securely move funds and data between Arbitrum Sepolia and Optimism Sepolia. This allows us to:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# HyperHarvest Smart Contract
---
cover: >-
https://images.unsplash.com/photo-1521791055366-0d553872125f?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHwxfHxjb250cmFjdHxlbnwwfHx8fDE3MjU3ODI1OTF8MA&ixlib=rb-4.0.3&q=85
coverY: 0
---

# 🎛️ HyperHarvest Smart Contract

Our system revolves around a single smart contract, HyperHarvest.sol, which serves multiple purposes:

Expand Down
18 changes: 14 additions & 4 deletions documentation/basics/architecture/system-overview.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# System Overview
---
cover: >-
https://images.unsplash.com/photo-1488972685288-c3fd157d7c7a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHwyfHxhcmNoaXRlY3R1cmV8ZW58MHx8fHwxNzI1NzgyNTU4fDA&ixlib=rb-4.0.3&q=85
coverY: 0
---

# 👨‍💼 System Overview

\
\
Our Cross-Chain Yield Aggregator consists of several interconnected components:

<figure><img src="../../.gitbook/assets/image.png" alt=""><figcaption><p>HyperHarvest Architecture</p></figcaption></figure>

1. **HyperHarvest Smart Contract**: The core of our system, deployed on Arbitrum Sepolia and Optimism Sepolia.
2. **Lit Protocol**: Handles the encryption and execution of our private strategies.
2. **Lit Protocol**: Handles the encryption , decryption , execution of our private strategies time to time to ensure optimal yields.
3. **Chainlink CCIP**: Facilitates cross-chain communication and fund transfers.
4. **Envio**: Hyperindexes blockchain data for real-time yield calculations and event tracking.
5. **XMTP**: Provides real-time notifications to users.
4. **Envio**: Hyperindexes blockchain data for real-time yield calculations and event tracking for real time notifications.
5. **XMTP Bot** : Provides real-time notifications to users and method to deposit/withdraw using frames in the bot.
6. **Web3Auth**: Enables social login and account abstraction.
7. **Frontend**: A user-friendly interface for interacting with the protocol.
21 changes: 1 addition & 20 deletions documentation/basics/core-components/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# Core Components

GitBook supports many different types of content, and is backed by Markdown — meaning you can copy and paste any existing Markdown files directly into the editor!

<figure><img src="https://gitbookio.github.io/onboarding-template-images/markdown-hero.png" alt=""><figcaption></figcaption></figure>

Feel free to test it out and copy the Markdown below by hovering over the code block in the upper right, and pasting into a new line underneath.

```markdown
# Heading

This is some paragraph text, with a [link](https://docs.gitbook.com) to our docs.

## Heading 2
- Point 1
- Point 2
- Point 3
```

{% hint style="info" %}
If you have multiple files, GitBook makes it easy to import full repositories too — allowing you to keep your GitBook content in sync.
{% endhint %}
Proceed to HyperHarvest Vault ->
61 changes: 61 additions & 0 deletions documentation/basics/core-components/chainlink-ccip-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
cover: >-
https://images.unsplash.com/photo-1424039398480-172b5bc4526d?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHwzfHxjaGFpbmxpbmt8ZW58MHx8fHwxNzI1NzgzNTY3fDA&ixlib=rb-4.0.3&q=85
coverY: 0
---

# 🔗 Chainlink CCIP Integration

### Overview

Our project utilizes Chainlink's Cross-Chain Interoperability Protocol (CCIP) to enable seamless transfer of USDC funds between different blockchain networks. The HyperHarvest contract serves as both a vault and a gateway for receiving CCIP messages and funds.

### Key Features

* **Cross-Chain Fund Transfer**: Ability to move USDC funds between different blockchain networks.
* **Integrated Vault Functionality**: HyperHarvest contract acts as a vault for storing user funds.
* **CCIP Message Handling**: Built-in capability to process incoming CCIP messages and funds.

### Technical Implementation

#### **CCIP Router Integration**

The contract inherits from CCIPReceiver, which provides the necessary functionality to interact with the CCIP router:

```
contract HyperHarvest is ERC4626, CCIPReceiver, ReentrancyGuard {
// ...
}
```

#### **Cross-Chain Asset Transfer**

The bridgeAndSupplyAssetToAave function prepares and sends CCIP messages to transfer assets:

```
function bridgeAndSupplyAssetToAave(
address _receiver,
uint256 _gasFeeAmount,
uint64 _destinationChainSelector
) public onlyAllowed(msg.sender) returns (bytes32 messageId) {
// ... (Function implementation)
}
```

#### **CCIP Message Reception**

The \_ccipReceive function handles incoming CCIP messages:

```
function _ccipReceive(
Client.Any2EVMMessage memory message
) internal override nonReentrant {
// ... (Function implementation)
}
```

### Benefits

* **Interoperability**: Enables seamless movement of funds across different blockchain networks.
* **Enhanced Yield Opportunities**: Allows users to access yield opportunities on multiple chains.
* **Automated Cross-Chain Operations**: Facilitates automated fund transfers and yield farming across chains.
58 changes: 53 additions & 5 deletions documentation/basics/core-components/envio-integration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,55 @@
# Envio Integration
---
cover: >-
https://images.unsplash.com/photo-1489875347897-49f64b51c1f8?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHwxfHxkYXRhYmFzZXxlbnwwfHx8fDE3MjU3ODM0NDN8MA&ixlib=rb-4.0.3&q=85
coverY: 0
---

Envio is a key component that enables real-time data processing and event tracking:
# 📇 Envio Integration

1. **Aave Data Indexing**: We use Envio to index Aave contract data, allowing us to calculate the latest yield rates with minimal delay.
2. **HyperHarvest Event Tracking**: Envio indexes events from our HyperHarvest contract, including deposits, withdrawals, and cross-chain transfers.
3. **Notification Triggering**: The indexed data is used to trigger XMTP notifications, ensuring users are promptly informed of important events.
### Overview

Our project utilizes Envio's HyperIndex to efficiently index blockchain data and serve it to our application. HyperIndex is designed to deliver superior performance and provide a seamless developer experience, which in turn optimizes the user experience of our application.

### Key Features

* **Real-time Data Indexing**: We use HyperIndex to index smart contract data in real-time.
* **High-Performance API**: HyperIndex allows us to build a real-time API for our blockchain application quickly and efficiently.
* **Seamless Integration**: The indexed data is seamlessly integrated into our application, enhancing its functionality and user experience.

### Use Cases

We have implemented Envio's HyperIndex for the following purposes:

* **Aave Contract Indexing**: We index Aave contracts to monitor real-time liquidity changes in Aave.
* **HyperHarvest Contract Indexing**: We index our HyperHarvest contract to power a real-time notification system, which works in conjunction with XMTP.

### Benefits

* **Enhanced Performance**: HyperIndex optimizes data retrieval, leading to faster and more responsive application behavior.
* **Real-time Updates**: Our application can provide users with up-to-the-minute information on liquidity and other critical data points.
* **Improved User Experience**: The combination of real-time data and efficient indexing results in a smoother, more informative user interface.

### Technical Implementation

#### **Setup and Indexing**

We followed Envio's quick and easy guide to set up and index the contracts:

**Resource**: [Envio HyperIndex Documentation](https://docs.envio.dev/docs/HyperIndex/overview)

#### **Subgraph Deployment**

We have deployed two subgraphs as part of our Envio integration:

1. Aave yield API: [https://indexer.bigdevenergy.link/93d433c/v1/graphql](https://indexer.bigdevenergy.link/93d433c/v1/graphql)
2. HyperHarvest Notifications API: [https://indexer.bigdevenergy.link/a861e6e/v1/graphql](https://indexer.bigdevenergy.link/a861e6e/v1/graphql)

These subgraphs serve as the backbone for our data querying and retrieval system, allowing us to efficiently access indexed blockchain data.

### Integration with XMTP

The Envio integration complements our XMTP implementation by providing the backend data infrastructure needed for real-time notifications and updates. When significant events occur (such as liquidity changes in Aave or updates in our HyperHarvest contract), the Envio-indexed data triggers notifications that are then sent to users via the XMTP messaging system.

### Conclusion

By integrating Envio's HyperIndex into our project, we've significantly enhanced our ability to provide real-time, accurate blockchain data to our users. This integration works hand-in-hand with our XMTP implementation to create a responsive, informative, and user-friendly application that keeps users updated on critical changes and events in real-time.
10 changes: 8 additions & 2 deletions documentation/basics/core-components/hyperharvest-vault.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# HyperHarvest Vault
---
cover: >-
https://images.unsplash.com/photo-1718287888958-efa8b9c8375a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHJhbmRvbXx8fHx8fHx8fDE3MjU3ODI2OTB8&ixlib=rb-4.0.3&q=85
coverY: 0
---

# 🛬 HyperHarvest Vault

Our HyperHarvest contract follows the ERC4626 standard, which provides a standardized interface for yield-bearing vaults. This ensures compatibility with other DeFi protocols and makes it easier for developers to integrate with our platform.

Key features of our vault:
**Key features of our vault** :

* Mints HH shares to represent user deposits
* Handles deposits and withdrawals of USDC
Expand Down
61 changes: 56 additions & 5 deletions documentation/basics/core-components/lit-protocol-integration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,58 @@
# Lit Protocol Integration
---
cover: >-
https://images.unsplash.com/photo-1536374863418-41d096a7e679?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHw0fHxsaXR8ZW58MHx8fHwxNzI1NzgyODAzfDA&ixlib=rb-4.0.3&q=85
coverY: 0
---

Lit Protocol plays a crucial role in our system:
# 🔥 Lit Protocol Integration

1. **Encryption**: We use Lit to encrypt our strategy off-chain.
2. **Secure Execution**: Lit Actions provide a secure environment to decrypt and execute our strategy.
3. **Access Control**: We can specify conditions (e.g., caller must be our HyperHarvest contract) for strategy decryption.
### Overview

Our project leverages Lit Protocol to implement private strategies for our cross-chain yield aggregator. This integration allows us to compute over private data, determining optimal fund allocation across different chains while maintaining strategy confidentiality.

### Key Features

* **Private Strategy Computation**: We use Lit Actions to decrypt and compute private strategies.
* **Cross-Chain Yield Optimization**: The system determines the best chain for fund allocation based on current yields and transfer costs.
* **Automated Decision Making**: Our Lit Action script runs periodically to make informed decisions about fund transfers.

### Use Case

We have implemented Lit Protocol for the following purpose:

Strategy Decryption and Execution: Decrypt private strategies within Lit Actions and perform computations within lit actions based on the current market yield data on both chains , gas fees required for fund transfers and decrypted strategy parameters.

### Benefits

* **Competitive Advantage**: Private strategies give us an edge over other yield aggregators.
* **Enhanced Security**: Sensitive strategy data remains encrypted and is only decrypted within secure Lit Actions.
* **Optimized Yields**: Regular computations ensure users always get the best possible yields.
* **User Experience**: Automated decision-making provides a seamless experience for users.

### Technical Implementation

**Lit Action Implementation**

Our Strategy Executor script performs the following tasks:

* Decrypts the Encrypted private strategy data within the lit action .
* Computes current yields on different chains (e.g., Optimism Sepolia and Arbitrum Sepolia).
* Calculates total transfer costs, including CCIP and network fees.
* Lit action determines if a fund transfer would result in higher yields for users based on the decrypted strategy .
* Lit action returns the target chain and a boolean indicating whether to move funds.
* Funds get transferred from one chain to other if required according to the result returned by the Lit action.

We have implemented a simple strategy for HyperHarvest but as the number of chains and number of protocol integrations increase the complexity of the strategy would increase significantly and the exclusiveness of the strategy would give us huge competitive advantage while keeping the users aware of the events happening inside HyperHarvest using XMTP notifications for different events such as fund transfers, deposits, withdrawals etc.

The script runs every 4 hours to ensure timely decision-making and highest yield possible .

#### Integration with CCIP

Based on the Lit Action's response, we use Chainlink's Cross-Chain Interoperability Protocol (CCIP) to transfer funds between chains when beneficial.

### Code

For the detailed implementation of our Lit Protocol integration, please refer to:

* [StrategyExecutor Script](https://github.com/ETHarvest/HyperHarvest/blob/main/packages/nextjs/scripts/strategyExecutor.js)
* [Lit Action](https://github.com/ETHarvest/HyperHarvest/blob/main/packages/nextjs/utils/lit-protocol/strategyAction.js)
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Private Strategy Mechanism
---
cover: >-
https://images.unsplash.com/photo-1527057629248-91865e448574?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxOTcwMjR8MHwxfHNlYXJjaHw1fHxwcml2YXRlfGVufDB8fHx8MTcyNTc4Mjc2MXww&ixlib=rb-4.0.3&q=85
coverY: 0
---

# 📠 Private Strategy Mechanism

Our private strategy is the secret sauce that gives our platform its edge. Here's how it works:

Expand Down
Loading
Loading