-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed broken links, Added a seperate section on extending pooler
- Loading branch information
1 parent
17f1b5f
commit 2eb2e2c
Showing
6 changed files
with
95 additions
and
29 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
docs/Build-with-Powerloom/UniswapV2 Dashboard/Extending-Uniswapv2-Dashboard.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
# Extending the UniswapV2 Dashboard | ||
|
||
This documentation provides a step-by-step guide for developers looking to extend the functionality of the UniswapV2 Dashboard, specifically focusing on implementing new data points. The goal is to empower developers to enhance the dashboard with custom features, making it a valuable tool in hackathons and blockchain analytics. | ||
|
||
## Extending with New Data Points | ||
|
||
:::tip | ||
Prerequisities: Before we dive into the implementation of new data points, you may want to look at the concept of how the pooler functions and how it retrives and processes the data. | ||
|
||
[Closer look into the Snapshot Datasets](/docs/Build-with-Powerloom/UniswapV2%20Dashboard/Tour%20of%20the%20existing%20implementation/closer-inspection-of-the-snapshot-datasets) | ||
::: | ||
|
||
### Scenario: 2-Hour Aggregate of Swap Events | ||
|
||
We'll use the example of creating a new data point that aggregates only Swap events over a 2-hour period. This involves capturing snapshots of Swap event logs and trade volumes within this timeframe. | ||
|
||
### Steps to Implement the New Data Point | ||
|
||
1. **Fork the Pooler Repository**: | ||
Begin by forking the [Pooler repository](https://github.com/powerloom/pooler). This will be your workspace for implementing the new feature. | ||
|
||
2. **Setup Development Environment**: | ||
Follow the setup instructions in the [`deploy` repository](https://github.com/powerloom/deploy) to prepare your development environment. This step ensures you have all the necessary tools and dependencies. | ||
|
||
3. **Configure Aggregation Worker**: | ||
In the `config/aggregator.json` file of your forked repository, add a new entry for your aggregation worker class. This class will be responsible for handling the new data aggregation task. | ||
- Define the `project_type` as something like `"aggregate_swap_events_2h"`. | ||
- Set `"aggregate_on"` to `"SingleProject"` or `"MultiProject"` depending on your aggregation logic. | ||
- Under `"processor"`, specify the module and class name of your new processor. | ||
```json | ||
{ | ||
"config": [ | ||
// ... existing configurations ... | ||
{ | ||
"project_type": "aggregate_swap_events_2h", | ||
"aggregate_on": "SingleProject", | ||
"processor": { | ||
"module": "snapshotter.modules.computes.aggregate.swap_event_2h", | ||
"class_name": "AggregateSwapEventProcessor" | ||
} | ||
} | ||
// ... additional configurations ... | ||
] | ||
} | ||
``` | ||
|
||
4. **Create a New Data Model**: | ||
Develop a new data model in [`utils/message_models.py`](https://github.com/PowerLoom/snapshotter-computes/blob/eth_uniswapv2/utils/models/message_models.py). Use existing models like `UniswapTradesAggregateSnapshot` and `UniswapTradesSnapshot` as references. Your model should be tailored to capture and represent data specific to the 2-hour Swap event aggregation. | ||
|
||
5. **Focus on 2-Hour Time Span and Swap Events**: | ||
Modify the data collection logic to concentrate on a 2-hour time span (`epochId`). Ensure that your implementation is set to extract only Swap event logs and their associated trade volumes. Refer to the existing 24-hour aggregation example for guidance on structuring your logic. | ||
|
||
6. **Testing and Validation**: | ||
After implementation, rigorously test your new feature to ensure accuracy and efficiency. Validate that the data collected aligns with your intended 2-hour aggregation of Swap events. | ||
|
||
7. **Commit and Share Your Work**: | ||
Once your implementation is complete and tested, commit your changes to your implementation branch. Share your work with the community by creating a pull request to the main Pooler repository, if desired. | ||
|
||
## Why Extend the UniswapV2 Dashboard? | ||
|
||
Extending the UniswapV2 Dashboard is an excellent opportunity for developers to: | ||
|
||
- **Contribute to Open Source**: Enhance a widely-used tool and give back to the community. | ||
- **Learn and Experiment**: Gain hands-on experience with blockchain data and smart contract interactions. | ||
- **Create Custom Analytics**: Tailor the dashboard to specific analytical needs, making it more versatile and useful. | ||
- **Showcase Skills**: Use the extended dashboard as a portfolio piece in hackathons and professional settings. | ||
|
||
|
||
Extending the UniswapV2 Dashboard with new data points like a 2-hour aggregate of Swap events is an exciting thing to work on. It requires a good understanding of blockchain data, smart contract events, and data modeling. By following the steps outlined in this guide, developers can successfully enhance the dashboard, making it a more powerful tool for blockchain analytics and research. | ||
|
||
If you have any questions while building / integrating, you can reach us out on our [discord](https://discord.com/powerloom). |
2 changes: 1 addition & 1 deletion
2
...ld-with-Powerloom/UniswapV2 Dashboard/Tour of the existing implementation/_category_.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters