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

Feat/uniswapv3 #39

Merged
merged 12 commits into from
Jun 7, 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
2 changes: 1 addition & 1 deletion docs/Protocol/Specifications/Snapshotter/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ In the end,

Its API endpoints are used by a decoupled frontend adapter logic that ultimately support building of rich data products for smart contracts and other web3 based applications.

In our [`All about Data` section of docs](/docs/build-with-powerloom/snapshotter-node/data), find out more about the way this API is used by a frontend adapter to serve a Uniswap v2 dashboard.
In our [`All about Data` section of docs](/docs/build-with-powerloom/snapshotter-node/data), find out more about the way this API is used by a frontend adapter to serve the Uniswap V2, Uniswap V3, and Aave V3 dashboards.
18 changes: 9 additions & 9 deletions docs/Protocol/Specifications/Snapshotter/snapshot-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 2
## Snapshot Computation Modules
---

As briefly introduced in the section on snapshotter implementations that [leverage Git Submodules for specific computation logic](/docs/build-with-powerloom/snapshotter-node/architecture), the modules are specified in the configuration for project types under the key `processor`.
As briefly introduced in the section on Snapshotter implementations that [leverage Git Submodules for specific computation logic](/docs/build-with-powerloom/snapshotter-node/architecture), the modules are specified in the configuration for project types under the key `processor`.

```json reference
https://github.com/Powerloom/snapshotter-configs/blob/39e4713cdd96fff99d100f1dea7fb7332df9e491/projects.example.json#L15-L28
Expand All @@ -18,7 +18,7 @@ Let's take the example of the snapshot builder configured for the project type
```python reference
https://github.com/Powerloom/snapshotter-computes/blob/29199feab449ad0361b5867efcaae9854992966f/owlto_bridge.py#L1-L31
```
As observed, it implements the`compute()` interface expected from snapshotter implementations inheriting `GenericProcessorSnapshot`.
As observed, it implements the `compute()` interface expected from Snapshotter implementations inheriting `GenericProcessorSnapshot`.

```python reference
https://github.com/Powerloom/pooler/blob/634610801a7fcbd8d863f2e72a04aa8204d27d03/snapshotter/utils/callback_helpers.py#L179-L196
Expand All @@ -36,7 +36,7 @@ The data sources are specified against the `projects` key in the configuration s

1. If `bulk_mode` is set to `False` and an empty array is assigned to the `projects`:

The snapshotter node attempts to retrieve data sources corresponding to the `projects` key from the protocol state.
The Snapshotter node attempts to retrieve data sources corresponding to the `projects` key from the protocol state.

```python reference title="Processor Distributor synchronizing projects from protocol"
https://github.com/Powerloom/pooler/blob/634610801a7fcbd8d863f2e72a04aa8204d27d03/snapshotter/processor_distributor.py#L321-L332
Expand Down Expand Up @@ -102,7 +102,7 @@ https://github.com/Powerloom/pooler/blob/634610801a7fcbd8d863f2e72a04aa8204d27d0

### Example of snapshot computation

#### Base snapshot of trade events for the [Uniswap V2 dashboard data market](/docs/category/uniswapv2-dashboard):
#### Base snapshot of trade events for the [Uniswap V2 and V3 dashboard data markets](/docs/category/uniswap-dashboard):
```python reference
https://github.com/Powerloom/snapshotter-computes/blob/6fb98b1bbc22be8b5aba8bdc860004d35786f4df/trade_volume.py#L14-L44
```
Expand All @@ -111,13 +111,13 @@ https://github.com/Powerloom/snapshotter-computes/blob/6fb98b1bbc22be8b5aba8bdc8
## Aggregate Snapshots
---

Aggregate and higher-order snapshots that build on base snapshots are configured in their specific repositories, such as the following in our [Uniswap V2 Dashboard use case](/docs/category/uniswapv2-dashboard). This is where you can observe the [dependency graph of snapshot composition](/docs/protocol/data-composition#dependency-graph) in action.
Aggregate and higher-order snapshots that build on base snapshots are configured in their specific repositories, such as the following in our [Uniswap Dashboard use case](/docs/category/uniswap-dashboard). This is where you can observe the [dependency graph of snapshot composition](/docs/protocol/data-composition#dependency-graph) in action.

:::info

- [Single Project Composition](/docs/protocol/data-composition#single-project-composition)
- [Multi-Project Composition](/docs/protocol/data-composition#multiple-projects-composition)
- [Walkthrough of the Snapshotter Implementation for Uniswap V2 Dashboard](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/)
- [Walkthrough of the Snapshotter Implementation for the Uniswap V2 and V3 Dashboards](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/)
:::

The order and dependencies of these compositions are specified according to the `aggregate_on` key.
Expand All @@ -133,7 +133,7 @@ https://github.com/Powerloom/snapshotter-configs/blob/fcf9b852bac9694258d7afcd8b
* For example, a base snapshot built on a project ID like `pairContract_trade_volume:0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc:UNISWAPV2` triggers the worker `AggregateTradeVolumeProcessor` as defined in the `processor` config, against the pair contract `0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc`.
* The span of epochs on which corresponding base snapshots will be aggregated is determined by the logic contained in the module specified in the `processor` key.

The following implementation aggregates [trade volume snapshots](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/closer-look-at-snapshots.md) across a span of 24 hours worth of epochs, if available. Otherwise, it aggregates the entire span of epochs available on the protocol against the data market and reports it back.
The following implementation aggregates [trade volume snapshots](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/closer-look-at-snapshots.md) across a span of 24 hours worth of epochs, if available. Otherwise, it aggregates the entire span of epochs available on the protocol against the data market and reports it back.


```python reference
Expand All @@ -149,7 +149,7 @@ https://github.com/Powerloom/snapshotter-configs/blob/fcf9b852bac9694258d7afcd8b
* `projects_to_wait_for` specifies the exact project IDs on which this higher-order aggregation will be generated.
* The aggregation snapshot build for this is triggered once a snapshot build has been achieved for an `epochId`.

The configuration above generates a dataset that can be further used to render a dashboard containing trade information across a large number of Uniswap v2 pair contracts.
The configuration above generates a dataset that can be further used to render a dashboard containing trade information across a large number of Uniswap V2 pair contracts.

### Project ID Generation

Expand All @@ -161,4 +161,4 @@ The following is the section where the relevant project IDs are generated accord

```python reference
https://github.com/Powerloom/pooler/blob/d8b7be32ad329e8dcf0a7e5c1b27862894bc990a/snapshotter/utils/aggregation_worker.py#L59-L92
```
```
2 changes: 1 addition & 1 deletion docs/Protocol/data-composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ As defined by the data sources configuration, the protocol state collects snapsh

## Higher-Order Aggregations

An example of this can be found in the [Uniswap V2 dashboard implementation](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/), where a trade activity aggregation dataset is generated by:
An example of this can be found in the [Uniswap V2 and V3 dashboard implementation](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/), where a trade activity aggregation dataset is generated by:

- Combining individual snapshots of trade volume and fees across multiple pair contracts.
- Spanning a specific set of epochs that satisfy a time duration (e.g., 24 hours).
Expand Down
4 changes: 2 additions & 2 deletions docs/Protocol/data-sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ The data sources defined by a market can be static or dynamic, depending on the

## Static Data Sources

Our implementation of a data market serves datasets to render live Uniswap V2 and Aave V3 dashboards. Further details about the data source configurations and snapshot schemas can be found in the following sections of our documentation:
Our implementation of a data market serves datasets to render live Uniswap V2, Uniswap V3, and Aave V3 dashboards. Further details about the data source configurations and snapshot schemas can be found in the following sections of our documentation:

* [Building with Powerloom -- Uniswap V2 Dashboard](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/)
* [Building with Powerloom -- Uniswap V2 and V3 Dashboards](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/)
* [Building with Powerloom -- Aave V3 Dashboard](/docs/build-with-powerloom/use-cases/existing-implementations/aavev3-dashboard/)

Continuing with the Uniswap V2 example, you can explore the data sources list defined as part of the Uniswap v2 specific configuration in the [`snapshotter-configs`](https://github.com/Powerloom/snapshotter-configs/blob/fcf9b852bac9694258d7afcd8beeaa4cf961c65f/projects.example.json#L1-L11) repository.
Expand Down
2 changes: 1 addition & 1 deletion docs/build-with-powerloom/devnet/Glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ We can compose snapshots on top of base snapshots for single or multiple contrac
- Combining individual snapshots of trade volume and fees across multiple pair contracts.
- Spanning a specific set of epochs that satisfy a time duration (e.g., 24 hours).

To learn more about Snapshot Composition, start with this [guide](https://docs.powerloom.io/docs/Protocol/data-composition), then explore [Data Points](https://docs.powerloom.io/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/data-points) for a use case-driven approach, and finally read through [Closer Look at Snapshots](https://docs.powerloom.io/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/closer-look-at-snapshots) for a detailed understanding.
To learn more about Snapshot Composition, start with this [guide](https://docs.powerloom.io/docs/Protocol/data-composition), then explore [Data Points](https://docs.powerloom.io/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/data-points) for a use case-driven approach, and finally read through [Closer Look at Snapshots](https://docs.powerloom.io/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/closer-look-at-snapshots) for a detailed understanding.

### Relayers
Entities or nodes within a decentralized network responsible for relaying or forwarding messages, transactions, or data between different participants. Relayers play a crucial role in facilitating communication and interoperability within distributed systems.
Expand Down
2 changes: 2 additions & 0 deletions docs/build-with-powerloom/snapshotter-node/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ You can observe the corresponding branches within [snapshotter-configs](https://
#### Snapshotter Computes
* `eth_uniswapv2`: Pooler implementation for the Uniswap v2 dashboard
* `eth_uniswapv2_lite`: Pooler implementation for the Uniswap v2 dashboard but without the calculation of complex aggregate data points from scratch.
* `eth_uniswapv3`: Pooler implementation for the Uniswap v3 dashboard
* `aave`: Pooler implementation for the Aave v3 dashboard
* `aave-lite`: Pooler implementation for the Aave v3 dashboard but without the calculation of complex aggregate data points from scratch.
* `zkevm_quests`: Implementation for Quests on Polygon zkEVM

#### Snapshotter Configs
* `eth_uniswapv2_5_pairs`: Pooler lite mode config with only 5 chosen Uniswap v2 pair contracts
* `eth_uniswapv2`: Pooler config with only 180 Uniswap v2 pair contracts
* `eth_uniswapv3`: Pooler config with 46 Uniswap v3 pool contracts
* `aave`: Pooler config with all Aave v3 asset contracts
* `aave-lite`: Pooler config to be used with the aave-lite compute branch
* `zkevm_quests`: Config for Quests on Polygon zkEVM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This documentation provides a step-by-step guide for developers looking to exten
:::tip
Prerequisites: 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 retrieves and processes the data.

[Closer look into the Snapshot Datasets](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/closer-look-at-snapshots)
[Closer look into the Snapshot Datasets](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/closer-look-at-snapshots)
:::

### Scenario: 2-Hour Aggregate of Swap Events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 0

## Pooler - AaveV3 Data Market

Powerloom's AaveV3 dashboard is an [extension](/docs/build-with-powerloom/use-cases/building-new-usecase/extending-uniswapv2-dashboard) of the Pooler framework. Its design is similar to the [UniswapV2](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/) dashboard use case. The data network is powered by [Snapshotters](/docs/build-with-powerloom/snapshotter-node/introduction) who capture critical data points from Aave's on-chain Smart Contracts. This data is then processed, aggregated, and displayed on the dashboard to provide users of the Aave protocol with actionable metrics. This implementation is a testament to the composable nature of Pooler and the Powerloom data network's flexibility in capturing a diverse range of data points.
Powerloom's AaveV3 dashboard is an [extension](/docs/build-with-powerloom/use-cases/building-new-usecase/extending-uniswapv2-dashboard) of the Pooler framework. Its design is similar to the [Uniswap](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/) dashboard use case. The data network is powered by [Snapshotters](/docs/build-with-powerloom/snapshotter-node/introduction) who capture critical data points from Aave's on-chain Smart Contracts. This data is then processed, aggregated, and displayed on the dashboard to provide users of the Aave protocol with actionable metrics. This implementation is a testament to the composable nature of Pooler and the Powerloom data network's flexibility in capturing a diverse range of data points.

The Dashboard is hosted at [aave-v3.powerloom.io/](https://aave-v3.powerloom.io/)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Prerequisite: Ensure that the minimum requirements are met by the system on whic
## Extending the Aave V3 Implementation

:::tip
This section will utilize core concepts explained in the [Closer Look at Snapshots](/docs/build-with-powerloom/use-cases/existing-implementations/uniswapv2-dashboard/closer-look-at-snapshots) section. It is strongly recommended that you review this page before extending the Aave use case.
This section will utilize core concepts explained in the [Closer Look at Snapshots](/docs/build-with-powerloom/use-cases/existing-implementations/uniswap-dashboard/closer-look-at-snapshots) section. It is strongly recommended that you review this page before extending the Aave use case.
:::

### Development Node Setup
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Uniswap Dashboard",
"position": 0,
"link": {
"type": "generated-index",
"description": "UniswapV2 and UniswapV3 Dashboard Implementation using Powerloom protocol"
}
}
Loading
Loading