From 050ae59a83f846203829cde4072a8351426ab666 Mon Sep 17 00:00:00 2001 From: zizou <111426680+flopell@users.noreply.github.com> Date: Fri, 11 Oct 2024 14:18:22 +0200 Subject: [PATCH] refactor(substreams): refactor uniswapv3 to use `tycho-substreams` --- substreams/Cargo.lock | 1 + substreams/ethereum-uniswap-v3/Cargo.toml | 1 + .../arbitrum-uniswap-v3.yaml | 3 - substreams/ethereum-uniswap-v3/buf.gen.yaml | 12 + .../ethereum-uniswap-v3.yaml | 3 - .../ethereum-uniswap-v3/src/events/burn.rs | 3 +- .../ethereum-uniswap-v3/src/events/collect.rs | 3 +- .../src/events/collect_fee_protocol.rs | 6 +- .../ethereum-uniswap-v3/src/events/flash.rs | 3 +- .../src/events/initialize.rs | 3 +- .../ethereum-uniswap-v3/src/events/mint.rs | 6 +- .../ethereum-uniswap-v3/src/events/mod.rs | 6 +- .../src/events/set_fee_protocol.rs | 3 +- .../ethereum-uniswap-v3/src/events/swap.rs | 3 +- substreams/ethereum-uniswap-v3/src/lib.rs | 1 - .../src/modules/1_map_pool_created.rs | 11 +- .../src/modules/2_store_pools.rs | 4 +- .../src/modules/5_map_pool_events.rs | 9 +- substreams/ethereum-uniswap-v3/src/pb/mod.rs | 9 - .../src/pb/tycho.evm.v1.rs | 307 ---------- .../src/pb/uniswap.types.v1.rs | 541 ------------------ .../src/storage/pool_storage.rs | 6 +- substreams/ethereum-uniswap-v3/src/traits.rs | 30 - 23 files changed, 46 insertions(+), 928 deletions(-) create mode 100644 substreams/ethereum-uniswap-v3/buf.gen.yaml delete mode 100644 substreams/ethereum-uniswap-v3/src/pb/tycho.evm.v1.rs delete mode 100644 substreams/ethereum-uniswap-v3/src/pb/uniswap.types.v1.rs delete mode 100644 substreams/ethereum-uniswap-v3/src/traits.rs diff --git a/substreams/Cargo.lock b/substreams/Cargo.lock index 84e0b41..fc205c4 100644 --- a/substreams/Cargo.lock +++ b/substreams/Cargo.lock @@ -1070,6 +1070,7 @@ dependencies = [ "substreams-ethereum", "substreams-helper", "tiny-keccak", + "tycho-substreams", ] [[package]] diff --git a/substreams/ethereum-uniswap-v3/Cargo.toml b/substreams/ethereum-uniswap-v3/Cargo.toml index e4c9359..101914d 100644 --- a/substreams/ethereum-uniswap-v3/Cargo.toml +++ b/substreams/ethereum-uniswap-v3/Cargo.toml @@ -15,6 +15,7 @@ ethabi.workspace = true anyhow = { workspace = true, features = [] } hex-literal.workspace = true substreams-helper.workspace = true +tycho-substreams.workspace = true num-bigint = "0.4.4" hex.workspace = true tiny-keccak = "2.0" diff --git a/substreams/ethereum-uniswap-v3/arbitrum-uniswap-v3.yaml b/substreams/ethereum-uniswap-v3/arbitrum-uniswap-v3.yaml index 1d3f0f7..4937787 100644 --- a/substreams/ethereum-uniswap-v3/arbitrum-uniswap-v3.yaml +++ b/substreams/ethereum-uniswap-v3/arbitrum-uniswap-v3.yaml @@ -5,12 +5,9 @@ package: protobuf: files: - - tycho/evm/v1/common.proto - - tycho/evm/v1/entity.proto - uniswap.proto importPaths: - ./proto/v1 - - ../../proto/ binaries: default: diff --git a/substreams/ethereum-uniswap-v3/buf.gen.yaml b/substreams/ethereum-uniswap-v3/buf.gen.yaml new file mode 100644 index 0000000..d2e6544 --- /dev/null +++ b/substreams/ethereum-uniswap-v3/buf.gen.yaml @@ -0,0 +1,12 @@ + +version: v1 +plugins: +- plugin: buf.build/community/neoeinstein-prost:v0.2.2 + out: src/pb + opt: + - file_descriptor_set=false + +- plugin: buf.build/community/neoeinstein-prost-crate:v0.3.1 + out: src/pb + opt: + - no_features diff --git a/substreams/ethereum-uniswap-v3/ethereum-uniswap-v3.yaml b/substreams/ethereum-uniswap-v3/ethereum-uniswap-v3.yaml index aeda329..e26388c 100644 --- a/substreams/ethereum-uniswap-v3/ethereum-uniswap-v3.yaml +++ b/substreams/ethereum-uniswap-v3/ethereum-uniswap-v3.yaml @@ -5,12 +5,9 @@ package: protobuf: files: - - tycho/evm/v1/common.proto - - tycho/evm/v1/entity.proto - uniswap.proto importPaths: - ./proto/v1 - - ../../proto/ binaries: default: diff --git a/substreams/ethereum-uniswap-v3/src/events/burn.rs b/substreams/ethereum-uniswap-v3/src/events/burn.rs index 2152244..7ed16a2 100644 --- a/substreams/ethereum-uniswap-v3/src/events/burn.rs +++ b/substreams/ethereum-uniswap-v3/src/events/burn.rs @@ -3,11 +3,12 @@ use substreams_helper::storage_change::StorageChangesFilter; use crate::{ abi::pool::events::Burn, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; use super::{BalanceDelta, EventTrait}; +use tycho_substreams::prelude::Attribute; impl EventTrait for Burn { fn get_changed_attributes( diff --git a/substreams/ethereum-uniswap-v3/src/events/collect.rs b/substreams/ethereum-uniswap-v3/src/events/collect.rs index 8969d67..835505d 100644 --- a/substreams/ethereum-uniswap-v3/src/events/collect.rs +++ b/substreams/ethereum-uniswap-v3/src/events/collect.rs @@ -2,10 +2,11 @@ use substreams_ethereum::pb::eth::v2::StorageChange; use crate::{ abi::pool::events::Collect, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; use substreams_helper::storage_change::StorageChangesFilter; +use tycho_substreams::prelude::Attribute; use super::{BalanceDelta, EventTrait}; diff --git a/substreams/ethereum-uniswap-v3/src/events/collect_fee_protocol.rs b/substreams/ethereum-uniswap-v3/src/events/collect_fee_protocol.rs index 87fec7e..7467986 100644 --- a/substreams/ethereum-uniswap-v3/src/events/collect_fee_protocol.rs +++ b/substreams/ethereum-uniswap-v3/src/events/collect_fee_protocol.rs @@ -1,13 +1,13 @@ use substreams_ethereum::pb::eth::v2::StorageChange; use substreams_helper::storage_change::StorageChangesFilter; +use super::{BalanceDelta, EventTrait}; use crate::{ abi::pool::events::CollectProtocol, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; - -use super::{BalanceDelta, EventTrait}; +use tycho_substreams::prelude::Attribute; impl EventTrait for CollectProtocol { fn get_changed_attributes( diff --git a/substreams/ethereum-uniswap-v3/src/events/flash.rs b/substreams/ethereum-uniswap-v3/src/events/flash.rs index ccc08d4..dc3b6a4 100644 --- a/substreams/ethereum-uniswap-v3/src/events/flash.rs +++ b/substreams/ethereum-uniswap-v3/src/events/flash.rs @@ -2,10 +2,11 @@ use substreams_ethereum::pb::eth::v2::StorageChange; use crate::{ abi::pool::events::Flash, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; use substreams_helper::storage_change::StorageChangesFilter; +use tycho_substreams::prelude::Attribute; use super::{BalanceDelta, EventTrait}; diff --git a/substreams/ethereum-uniswap-v3/src/events/initialize.rs b/substreams/ethereum-uniswap-v3/src/events/initialize.rs index cc1b9ef..7b94bba 100644 --- a/substreams/ethereum-uniswap-v3/src/events/initialize.rs +++ b/substreams/ethereum-uniswap-v3/src/events/initialize.rs @@ -2,10 +2,11 @@ use substreams_ethereum::pb::eth::v2::StorageChange; use crate::{ abi::pool::events::Initialize, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; use substreams_helper::storage_change::StorageChangesFilter; +use tycho_substreams::prelude::Attribute; use super::{BalanceDelta, EventTrait}; diff --git a/substreams/ethereum-uniswap-v3/src/events/mint.rs b/substreams/ethereum-uniswap-v3/src/events/mint.rs index f5374da..082f66a 100644 --- a/substreams/ethereum-uniswap-v3/src/events/mint.rs +++ b/substreams/ethereum-uniswap-v3/src/events/mint.rs @@ -1,13 +1,13 @@ use substreams_ethereum::pb::eth::v2::StorageChange; +use super::{BalanceDelta, EventTrait}; use crate::{ abi::pool::events::Mint, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; use substreams_helper::storage_change::StorageChangesFilter; - -use super::{BalanceDelta, EventTrait}; +use tycho_substreams::prelude::Attribute; impl EventTrait for Mint { fn get_changed_attributes( diff --git a/substreams/ethereum-uniswap-v3/src/events/mod.rs b/substreams/ethereum-uniswap-v3/src/events/mod.rs index 9d1f14c..1b69a47 100644 --- a/substreams/ethereum-uniswap-v3/src/events/mod.rs +++ b/substreams/ethereum-uniswap-v3/src/events/mod.rs @@ -7,11 +7,9 @@ use crate::{ abi::pool::events::{ Burn, Collect, CollectProtocol, Flash, Initialize, Mint, SetFeeProtocol, Swap, }, - pb::{ - tycho::evm::v1::Attribute, - uniswap::v3::{BalanceDelta, Pool}, - }, + pb::uniswap::v3::{BalanceDelta, Pool}, }; +use tycho_substreams::prelude::Attribute; pub mod burn; pub mod collect; diff --git a/substreams/ethereum-uniswap-v3/src/events/set_fee_protocol.rs b/substreams/ethereum-uniswap-v3/src/events/set_fee_protocol.rs index 80e394d..89d106f 100644 --- a/substreams/ethereum-uniswap-v3/src/events/set_fee_protocol.rs +++ b/substreams/ethereum-uniswap-v3/src/events/set_fee_protocol.rs @@ -2,10 +2,11 @@ use substreams_ethereum::pb::eth::v2::StorageChange; use crate::{ abi::pool::events::SetFeeProtocol, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; use substreams_helper::storage_change::StorageChangesFilter; +use tycho_substreams::prelude::Attribute; use super::{BalanceDelta, EventTrait}; diff --git a/substreams/ethereum-uniswap-v3/src/events/swap.rs b/substreams/ethereum-uniswap-v3/src/events/swap.rs index d69bcb4..d45e914 100644 --- a/substreams/ethereum-uniswap-v3/src/events/swap.rs +++ b/substreams/ethereum-uniswap-v3/src/events/swap.rs @@ -5,9 +5,10 @@ use substreams_helper::storage_change::StorageChangesFilter; use crate::{ abi::pool::events::Swap, - pb::{tycho::evm::v1::Attribute, uniswap::v3::Pool}, + pb::uniswap::v3::Pool, storage::{constants::TRACKED_SLOTS, pool_storage::UniswapPoolStorage}, }; +use tycho_substreams::prelude::Attribute; use super::{BalanceDelta, EventTrait}; diff --git a/substreams/ethereum-uniswap-v3/src/lib.rs b/substreams/ethereum-uniswap-v3/src/lib.rs index 77428d7..c363134 100644 --- a/substreams/ethereum-uniswap-v3/src/lib.rs +++ b/substreams/ethereum-uniswap-v3/src/lib.rs @@ -8,4 +8,3 @@ mod storage; pub use modules::*; mod events; -mod traits; diff --git a/substreams/ethereum-uniswap-v3/src/modules/1_map_pool_created.rs b/substreams/ethereum-uniswap-v3/src/modules/1_map_pool_created.rs index 4688ee2..fbe4e60 100644 --- a/substreams/ethereum-uniswap-v3/src/modules/1_map_pool_created.rs +++ b/substreams/ethereum-uniswap-v3/src/modules/1_map_pool_created.rs @@ -6,13 +6,8 @@ use substreams_ethereum::pb::eth::v2::{self as eth}; use substreams_helper::{event_handler::EventHandler, hex::Hexable}; -use crate::{ - abi::factory::events::PoolCreated, - pb::tycho::evm::v1::{ - Attribute, BlockChanges, ChangeType, EntityChanges, FinancialType, ImplementationType, - ProtocolComponent, ProtocolType, Transaction, TransactionChanges, - }, -}; +use crate::abi::factory::events::PoolCreated; +use tycho_substreams::prelude::*; #[substreams::handlers::map] pub fn map_pools_created( @@ -24,7 +19,7 @@ pub fn map_pools_created( get_new_pools(&block, &mut new_pools, factory_address); - Ok(BlockChanges { block: Some(block.into()), changes: new_pools }) + Ok(BlockChanges { block: Some((&block).into()), changes: new_pools }) } // Extract new pools from PoolCreated events diff --git a/substreams/ethereum-uniswap-v3/src/modules/2_store_pools.rs b/substreams/ethereum-uniswap-v3/src/modules/2_store_pools.rs index e70f64e..f4bafff 100644 --- a/substreams/ethereum-uniswap-v3/src/modules/2_store_pools.rs +++ b/substreams/ethereum-uniswap-v3/src/modules/2_store_pools.rs @@ -2,7 +2,9 @@ use std::str; use substreams::store::{StoreNew, StoreSetIfNotExists, StoreSetIfNotExistsProto}; -use crate::pb::{tycho::evm::v1::BlockChanges, uniswap::v3::Pool}; +use crate::pb::uniswap::v3::Pool; + +use tycho_substreams::prelude::BlockChanges; #[substreams::handlers::store] pub fn store_pools(pools_created: BlockChanges, store: StoreSetIfNotExistsProto) { diff --git a/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs b/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs index c31b3b2..008201e 100644 --- a/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs +++ b/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs @@ -6,12 +6,11 @@ use substreams_helper::hex::Hexable; use crate::{ events::{get_log_changed_attributes, get_log_changed_balances}, - pb::{ - tycho::evm::v1::{BalanceChange, Block, BlockChanges, EntityChanges, TransactionChanges}, - uniswap::v3::Pool, - }, + pb::uniswap::v3::Pool, }; +use tycho_substreams::prelude::*; + #[substreams::handlers::map] pub fn map_pool_events( block: eth::Block, @@ -110,7 +109,7 @@ pub fn map_pool_events( // Make a list of all HashMap values: let tx_entity_changes: Vec = tx_changes_map.into_values().collect(); - let tycho_block: Block = block.into(); + let tycho_block: Block = (&block).into(); let block_entity_changes = BlockChanges { block: Some(tycho_block), changes: tx_entity_changes }; diff --git a/substreams/ethereum-uniswap-v3/src/pb/mod.rs b/substreams/ethereum-uniswap-v3/src/pb/mod.rs index 39167a4..83e1f97 100644 --- a/substreams/ethereum-uniswap-v3/src/pb/mod.rs +++ b/substreams/ethereum-uniswap-v3/src/pb/mod.rs @@ -1,13 +1,4 @@ // @generated -pub mod tycho { - pub mod evm { - // @@protoc_insertion_point(attribute:tycho.evm.v1) - pub mod v1 { - include!("tycho.evm.v1.rs"); - // @@protoc_insertion_point(tycho.evm.v1) - } - } -} pub mod uniswap { // @@protoc_insertion_point(attribute:uniswap.v3) pub mod v3 { diff --git a/substreams/ethereum-uniswap-v3/src/pb/tycho.evm.v1.rs b/substreams/ethereum-uniswap-v3/src/pb/tycho.evm.v1.rs deleted file mode 100644 index 6dac022..0000000 --- a/substreams/ethereum-uniswap-v3/src/pb/tycho.evm.v1.rs +++ /dev/null @@ -1,307 +0,0 @@ -// @generated -// This file contains the proto definitions for Substreams common to all integrations. - -/// A struct describing a block. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Block { - /// The blocks hash. - #[prost(bytes="vec", tag="1")] - pub hash: ::prost::alloc::vec::Vec, - /// The parent blocks hash. - #[prost(bytes="vec", tag="2")] - pub parent_hash: ::prost::alloc::vec::Vec, - /// The block number. - #[prost(uint64, tag="3")] - pub number: u64, - /// The block timestamp. - #[prost(uint64, tag="4")] - pub ts: u64, -} -/// A struct describing a transaction. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Transaction { - /// The transaction hash. - #[prost(bytes="vec", tag="1")] - pub hash: ::prost::alloc::vec::Vec, - /// The sender of the transaction. - #[prost(bytes="vec", tag="2")] - pub from: ::prost::alloc::vec::Vec, - /// The receiver of the transaction. - #[prost(bytes="vec", tag="3")] - pub to: ::prost::alloc::vec::Vec, - /// The transactions index within the block. - #[prost(uint64, tag="4")] - pub index: u64, -} -/// A custom struct representing an arbitrary attribute of a protocol component. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Attribute { - /// The name of the attribute. - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - /// The value of the attribute. - #[prost(bytes="vec", tag="2")] - pub value: ::prost::alloc::vec::Vec, - /// The type of change the attribute underwent. - #[prost(enumeration="ChangeType", tag="3")] - pub change: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ProtocolType { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, - #[prost(enumeration="FinancialType", tag="2")] - pub financial_type: i32, - #[prost(message, repeated, tag="3")] - pub attribute_schema: ::prost::alloc::vec::Vec, - #[prost(enumeration="ImplementationType", tag="4")] - pub implementation_type: i32, -} -/// A struct describing a part of the protocol. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ProtocolComponent { - /// A unique identifier for the component within the protocol. - /// Can be a stringified address or a string describing the trading pair. - #[prost(string, tag="1")] - pub id: ::prost::alloc::string::String, - /// Addresses of the ERC20 tokens used by the component. - #[prost(bytes="vec", repeated, tag="2")] - pub tokens: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - /// Addresses of the contracts used by the component. - #[prost(bytes="vec", repeated, tag="3")] - pub contracts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - /// Attributes of the component. - /// The inner ChangeType of the attribute has to match the ChangeType of the ProtocolComponent. - #[prost(message, repeated, tag="4")] - pub static_att: ::prost::alloc::vec::Vec, - /// Type of change the component underwent. - #[prost(enumeration="ChangeType", tag="5")] - pub change: i32, - /// / Represents the functionality of the component. - #[prost(message, optional, tag="6")] - pub protocol_type: ::core::option::Option, - /// Transaction where this component was created - #[prost(message, optional, tag="7")] - pub tx: ::core::option::Option, -} -/// A struct for following the changes of Total Value Locked (TVL) of a protocol component. -/// Note that if the ProtocolComponent contains multiple contracts, the TVL is tracked for the component as a whole. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BalanceChange { - /// The address of the ERC20 token whose balance changed. - #[prost(bytes="vec", tag="1")] - pub token: ::prost::alloc::vec::Vec, - /// The new balance of the token. - #[prost(bytes="vec", tag="2")] - pub balance: ::prost::alloc::vec::Vec, - /// The id of the component whose TVL is tracked. Note: This MUST be utf8 encoded. - #[prost(bytes="vec", tag="3")] - pub component_id: ::prost::alloc::vec::Vec, -} -// Native entities - -/// A component is a set of attributes that are associated with a custom entity. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EntityChanges { - /// A unique identifier of the entity within the protocol. - #[prost(string, tag="1")] - pub component_id: ::prost::alloc::string::String, - /// The set of attributes that are associated with the entity. - #[prost(message, repeated, tag="2")] - pub attributes: ::prost::alloc::vec::Vec, -} -// VM entities - -/// A key value entry into contract storage. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ContractSlot { - /// A contract's storage slot. - #[prost(bytes="vec", tag="2")] - pub slot: ::prost::alloc::vec::Vec, - /// The new value for this storage slot. - #[prost(bytes="vec", tag="3")] - pub value: ::prost::alloc::vec::Vec, -} -/// Changes made to a single contract's state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ContractChange { - /// The contract's address - #[prost(bytes="vec", tag="1")] - pub address: ::prost::alloc::vec::Vec, - /// The new balance of the contract, empty bytes indicates no change. - #[prost(bytes="vec", tag="2")] - pub balance: ::prost::alloc::vec::Vec, - /// The new code of the contract, empty bytes indicates no change. - #[prost(bytes="vec", tag="3")] - pub code: ::prost::alloc::vec::Vec, - /// The changes to this contract's slots, empty sequence indicates no change. - #[prost(message, repeated, tag="4")] - pub slots: ::prost::alloc::vec::Vec, - /// Whether this is an update, a creation or a deletion. - #[prost(enumeration="ChangeType", tag="5")] - pub change: i32, -} -// Aggregate entities - -/// A set of changes aggregated by transaction. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionChanges { - /// The transaction instance that results in the changes. - #[prost(message, optional, tag="1")] - pub tx: ::core::option::Option, - /// Contains the changes induced by the above transaction, aggregated on a per-contract basis. - /// Contains the contract changes induced by the above transaction, usually for tracking VM components. - #[prost(message, repeated, tag="2")] - pub contract_changes: ::prost::alloc::vec::Vec, - /// Contains the entity changes induced by the above transaction. - /// Usually for tracking native components or used for VM extensions (plugins). - #[prost(message, repeated, tag="3")] - pub entity_changes: ::prost::alloc::vec::Vec, - /// An array of newly added components. - #[prost(message, repeated, tag="4")] - pub component_changes: ::prost::alloc::vec::Vec, - /// An array of balance changes to components. - #[prost(message, repeated, tag="5")] - pub balance_changes: ::prost::alloc::vec::Vec, -} -/// A set of transaction changes within a single block. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockChanges { - /// The block for which these changes are collectively computed. - #[prost(message, optional, tag="1")] - pub block: ::core::option::Option, - /// The set of transaction changes observed in the specified block. - #[prost(message, repeated, tag="2")] - pub changes: ::prost::alloc::vec::Vec, -} -/// Enum to specify the type of a change. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum ChangeType { - Unspecified = 0, - Update = 1, - Creation = 2, - Deletion = 3, -} -impl ChangeType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ChangeType::Unspecified => "CHANGE_TYPE_UNSPECIFIED", - ChangeType::Update => "CHANGE_TYPE_UPDATE", - ChangeType::Creation => "CHANGE_TYPE_CREATION", - ChangeType::Deletion => "CHANGE_TYPE_DELETION", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CHANGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "CHANGE_TYPE_UPDATE" => Some(Self::Update), - "CHANGE_TYPE_CREATION" => Some(Self::Creation), - "CHANGE_TYPE_DELETION" => Some(Self::Deletion), - _ => None, - } - } -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum FinancialType { - Swap = 0, - Lend = 1, - Leverage = 2, - Psm = 3, -} -impl FinancialType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - FinancialType::Swap => "SWAP", - FinancialType::Lend => "LEND", - FinancialType::Leverage => "LEVERAGE", - FinancialType::Psm => "PSM", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SWAP" => Some(Self::Swap), - "LEND" => Some(Self::Lend), - "LEVERAGE" => Some(Self::Leverage), - "PSM" => Some(Self::Psm), - _ => None, - } - } -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum ImplementationType { - Vm = 0, - Custom = 1, -} -impl ImplementationType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ImplementationType::Vm => "VM", - ImplementationType::Custom => "CUSTOM", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VM" => Some(Self::Vm), - "CUSTOM" => Some(Self::Custom), - _ => None, - } - } -} -// WARNING: DEPRECATED. Please use common.proto's TransactionChanges and BlockChanges instead. -// This file contains the definition for the native integration of Substreams. - -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionEntityChanges { - #[prost(message, optional, tag="1")] - pub tx: ::core::option::Option, - #[prost(message, repeated, tag="2")] - pub entity_changes: ::prost::alloc::vec::Vec, - /// An array of newly added components. - #[prost(message, repeated, tag="3")] - pub component_changes: ::prost::alloc::vec::Vec, - /// An array of balance changes to components. - #[prost(message, repeated, tag="4")] - pub balance_changes: ::prost::alloc::vec::Vec, -} -/// A set of transaction changes within a single block. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockEntityChanges { - /// The block for which these changes are collectively computed. - #[prost(message, optional, tag="1")] - pub block: ::core::option::Option, - /// The set of transaction changes observed in the specified block. - #[prost(message, repeated, tag="2")] - pub changes: ::prost::alloc::vec::Vec, -} -// @@protoc_insertion_point(module) diff --git a/substreams/ethereum-uniswap-v3/src/pb/uniswap.types.v1.rs b/substreams/ethereum-uniswap-v3/src/pb/uniswap.types.v1.rs deleted file mode 100644 index 80dc421..0000000 --- a/substreams/ethereum-uniswap-v3/src/pb/uniswap.types.v1.rs +++ /dev/null @@ -1,541 +0,0 @@ -// @generated -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Erc20Tokens { - #[prost(message, repeated, tag="1")] - pub tokens: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Erc20Token { - #[prost(string, tag="1")] - pub address: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub name: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub symbol: ::prost::alloc::string::String, - #[prost(uint64, tag="4")] - pub decimals: u64, - #[prost(string, tag="5")] - pub total_supply: ::prost::alloc::string::String, - #[prost(string, repeated, tag="6")] - pub whitelist_pools: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Liquidity { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="2")] - pub value: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Pools { - #[prost(message, repeated, tag="1")] - pub pools: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Pool { - #[prost(string, tag="1")] - pub address: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] - pub created_at_timestamp: u64, - #[prost(uint64, tag="4")] - pub created_at_block_number: u64, - #[prost(message, optional, tag="5")] - pub token0: ::core::option::Option, - #[prost(message, optional, tag="6")] - pub token1: ::core::option::Option, - /// Integer - #[prost(string, tag="7")] - pub fee_tier: ::prost::alloc::string::String, - /// internals - #[prost(int32, tag="30")] - pub tick_spacing: i32, - #[prost(uint64, tag="31")] - pub log_ordinal: u64, - #[prost(string, tag="32")] - pub transaction_id: ::prost::alloc::string::String, - #[prost(bool, tag="33")] - pub ignore_pool: bool, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Events { - #[prost(message, repeated, tag="1")] - pub pool_sqrt_prices: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="2")] - pub pool_liquidities: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="7")] - pub fee_growth_global_updates: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="10")] - pub fee_growth_inside_updates: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="11")] - pub fee_growth_outside_updates: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="3")] - pub pool_events: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] - pub transactions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="6")] - pub flashes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="8")] - pub ticks_created: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="9")] - pub ticks_updated: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="20")] - pub created_positions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="21")] - pub increase_liquidity_positions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="22")] - pub decrease_liquidity_positions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="23")] - pub collect_positions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="24")] - pub transfer_positions: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `Events`. -pub mod events { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct FeeGrowthGlobal { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - #[prost(uint64, tag="2")] - pub ordinal: u64, - #[prost(int32, tag="3")] - pub token_idx: i32, - /// Integer - #[prost(string, tag="4")] - pub new_value: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct FeeGrowthInside { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - #[prost(int32, tag="2")] - pub tick_idx: i32, - #[prost(uint64, tag="3")] - pub ordinal: u64, - /// Integer - #[prost(string, tag="4")] - pub new_value: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct FeeGrowthOutside { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - #[prost(int32, tag="2")] - pub tick_lower: i32, - #[prost(int32, tag="3")] - pub tick_upper: i32, - #[prost(uint64, tag="4")] - pub ordinal: u64, - /// Integer - #[prost(string, tag="5")] - pub new_value: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct TickCreated { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="2")] - pub idx: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] - pub log_ordinal: u64, - #[prost(uint64, tag="4")] - pub created_at_timestamp: u64, - #[prost(uint64, tag="5")] - pub created_at_block_number: u64, - /// Decimal - #[prost(string, tag="6")] - pub price0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="7")] - pub price1: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="8")] - pub amount: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct TickUpdated { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="2")] - pub idx: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] - pub log_ordinal: u64, - /// Integer - #[prost(string, tag="4")] - pub fee_growth_outside_0x_128: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="5")] - pub fee_growth_outside_1x_128: ::prost::alloc::string::String, - #[prost(uint64, tag="6")] - pub timestamp: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct PoolSqrtPrice { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - #[prost(uint64, tag="2")] - pub ordinal: u64, - /// Integer - #[prost(string, tag="3")] - pub sqrt_price: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="4")] - pub tick: ::prost::alloc::string::String, - #[prost(bool, tag="5")] - pub initialized: bool, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct PoolEvent { - #[prost(uint64, tag="100")] - pub log_ordinal: u64, - #[prost(uint64, tag="101")] - pub log_index: u64, - #[prost(string, tag="102")] - pub pool_address: ::prost::alloc::string::String, - #[prost(string, tag="103")] - pub token0: ::prost::alloc::string::String, - #[prost(string, tag="104")] - pub token1: ::prost::alloc::string::String, - #[prost(string, tag="105")] - pub fee: ::prost::alloc::string::String, - #[prost(string, tag="106")] - pub transaction_id: ::prost::alloc::string::String, - #[prost(uint64, tag="107")] - pub timestamp: u64, - #[prost(uint64, tag="108")] - pub created_at_block_number: u64, - #[prost(oneof="pool_event::Type", tags="1, 2, 3")] - pub r#type: ::core::option::Option, - } - /// Nested message and enum types in `PoolEvent`. - pub mod pool_event { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Swap { - #[prost(string, tag="1")] - pub sender: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub recipient: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub origin: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="4")] - pub amount_0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="5")] - pub amount_1: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="6")] - pub sqrt_price: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="7")] - pub liquidity: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="8")] - pub tick: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Burn { - #[prost(string, tag="1")] - pub owner: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub origin: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="3")] - pub amount: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="4")] - pub amount_0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="5")] - pub amount_1: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="6")] - pub tick_lower: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="7")] - pub tick_upper: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Mint { - #[prost(string, tag="1")] - pub owner: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub sender: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub origin: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="4")] - pub amount_0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="5")] - pub amount_1: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="6")] - pub tick_lower: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="7")] - pub tick_upper: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="8")] - pub amount: ::prost::alloc::string::String, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Type { - #[prost(message, tag="1")] - Swap(Swap), - #[prost(message, tag="2")] - Burn(Burn), - #[prost(message, tag="3")] - Mint(Mint), - } - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct PoolLiquidity { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="2")] - pub liquidity: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub token0: ::prost::alloc::string::String, - #[prost(string, tag="4")] - pub token1: ::prost::alloc::string::String, - /// internals - #[prost(uint64, tag="30")] - pub log_ordinal: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Flash { - #[prost(string, tag="1")] - pub pool_address: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="2")] - pub fee_growth_global_0x_128: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="3")] - pub fee_growth_global_1x_128: ::prost::alloc::string::String, - #[prost(uint64, tag="4")] - pub log_ordinal: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct Transaction { - #[prost(string, tag="1")] - pub id: ::prost::alloc::string::String, - #[prost(uint64, tag="2")] - pub block_number: u64, - #[prost(uint64, tag="3")] - pub timestamp: u64, - #[prost(uint64, tag="4")] - pub gas_used: u64, - /// Integer - #[prost(string, tag="5")] - pub gas_price: ::prost::alloc::string::String, - #[prost(uint64, tag="6")] - pub log_ordinal: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct PositionEvent { - #[prost(oneof="position_event::Type", tags="1, 2, 3, 4, 5")] - pub r#type: ::core::option::Option, - } - /// Nested message and enum types in `PositionEvent`. - pub mod position_event { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Type { - #[prost(message, tag="1")] - CreatedPosition(super::CreatedPosition), - #[prost(message, tag="2")] - IncreaseLiquidityPosition(super::IncreaseLiquidityPosition), - #[prost(message, tag="3")] - DecreaseLiquidityPosition(super::DecreaseLiquidityPosition), - #[prost(message, tag="4")] - CollectPosition(super::CollectPosition), - #[prost(message, tag="5")] - TransferPosition(super::TransferPosition), - } - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct CreatedPosition { - #[prost(string, tag="1")] - pub token_id: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub pool: ::prost::alloc::string::String, - #[prost(string, tag="3")] - pub token0: ::prost::alloc::string::String, - #[prost(string, tag="4")] - pub token1: ::prost::alloc::string::String, - #[prost(string, tag="5")] - pub tick_lower: ::prost::alloc::string::String, - #[prost(string, tag="6")] - pub tick_upper: ::prost::alloc::string::String, - #[prost(string, tag="7")] - pub transaction: ::prost::alloc::string::String, - #[prost(uint64, tag="8")] - pub log_ordinal: u64, - #[prost(uint64, tag="9")] - pub timestamp: u64, - #[prost(uint64, tag="10")] - pub block_number: u64, - /// BigInt - #[prost(string, optional, tag="11")] - pub fee_growth_inside0_last_x128: ::core::option::Option<::prost::alloc::string::String>, - /// BigInt - #[prost(string, optional, tag="12")] - pub fee_growth_inside1_last_x128: ::core::option::Option<::prost::alloc::string::String>, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct IncreaseLiquidityPosition { - #[prost(string, tag="1")] - pub token_id: ::prost::alloc::string::String, - /// BigInt - #[prost(string, tag="2")] - pub liquidity: ::prost::alloc::string::String, - /// BigDecimal - #[prost(string, tag="3")] - pub deposited_token0: ::prost::alloc::string::String, - /// BigDecimal - #[prost(string, tag="4")] - pub deposited_token1: ::prost::alloc::string::String, - /// BigInt - #[prost(string, optional, tag="5")] - pub fee_growth_inside0_last_x128: ::core::option::Option<::prost::alloc::string::String>, - /// BigInt - #[prost(string, optional, tag="6")] - pub fee_growth_inside1_last_x128: ::core::option::Option<::prost::alloc::string::String>, - #[prost(uint64, tag="10")] - pub log_ordinal: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct DecreaseLiquidityPosition { - #[prost(string, tag="1")] - pub token_id: ::prost::alloc::string::String, - /// BigInt - #[prost(string, tag="2")] - pub liquidity: ::prost::alloc::string::String, - /// BigDecimal - #[prost(string, tag="3")] - pub withdrawn_token0: ::prost::alloc::string::String, - /// BigDecimal - #[prost(string, tag="4")] - pub withdrawn_token1: ::prost::alloc::string::String, - /// BigInt - #[prost(string, optional, tag="5")] - pub fee_growth_inside0_last_x128: ::core::option::Option<::prost::alloc::string::String>, - /// BigInt - #[prost(string, optional, tag="6")] - pub fee_growth_inside1_last_x128: ::core::option::Option<::prost::alloc::string::String>, - #[prost(uint64, tag="10")] - pub log_ordinal: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct CollectPosition { - #[prost(string, tag="1")] - pub token_id: ::prost::alloc::string::String, - /// BigInt - #[prost(string, tag="2")] - pub collected_fees_token0: ::prost::alloc::string::String, - /// BigInt - #[prost(string, tag="3")] - pub collected_fees_token1: ::prost::alloc::string::String, - /// BigInt - #[prost(string, optional, tag="5")] - pub fee_growth_inside0_last_x128: ::core::option::Option<::prost::alloc::string::String>, - /// BigInt - #[prost(string, optional, tag="6")] - pub fee_growth_inside1_last_x128: ::core::option::Option<::prost::alloc::string::String>, - #[prost(uint64, tag="10")] - pub log_ordinal: u64, - } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] - pub struct TransferPosition { - #[prost(string, tag="1")] - pub token_id: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub owner: ::prost::alloc::string::String, - #[prost(uint64, tag="10")] - pub log_ordinal: u64, - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SnapshotPositions { - #[prost(message, repeated, tag="1")] - pub snapshot_positions: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SnapshotPosition { - #[prost(string, tag="1")] - pub pool: ::prost::alloc::string::String, - /// the token_id of the position - #[prost(string, tag="2")] - pub position: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] - pub block_number: u64, - #[prost(string, tag="4")] - pub owner: ::prost::alloc::string::String, - #[prost(uint64, tag="6")] - pub timestamp: u64, - /// Decimal - #[prost(string, tag="7")] - pub liquidity: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="8")] - pub deposited_token0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="9")] - pub deposited_token1: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="10")] - pub withdrawn_token0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="11")] - pub withdrawn_token1: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="12")] - pub collected_fees_token0: ::prost::alloc::string::String, - /// Decimal - #[prost(string, tag="13")] - pub collected_fees_token1: ::prost::alloc::string::String, - #[prost(string, tag="14")] - pub transaction: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="15")] - pub fee_growth_inside_0_last_x_128: ::prost::alloc::string::String, - /// Integer - #[prost(string, tag="16")] - pub fee_growth_inside_1_last_x_128: ::prost::alloc::string::String, - /// internal - #[prost(uint64, tag="17")] - pub log_ordinal: u64, -} -// @@protoc_insertion_point(module) diff --git a/substreams/ethereum-uniswap-v3/src/storage/pool_storage.rs b/substreams/ethereum-uniswap-v3/src/storage/pool_storage.rs index a0997f9..5569ef5 100644 --- a/substreams/ethereum-uniswap-v3/src/storage/pool_storage.rs +++ b/substreams/ethereum-uniswap-v3/src/storage/pool_storage.rs @@ -1,7 +1,5 @@ -use crate::{ - pb::tycho::evm::v1::{Attribute, ChangeType}, - storage::utils, -}; +use crate::storage::utils; +use tycho_substreams::prelude::{Attribute, ChangeType}; use substreams::scalar::BigInt; use substreams_ethereum::pb::eth::v2::StorageChange; diff --git a/substreams/ethereum-uniswap-v3/src/traits.rs b/substreams/ethereum-uniswap-v3/src/traits.rs deleted file mode 100644 index 4f573b8..0000000 --- a/substreams/ethereum-uniswap-v3/src/traits.rs +++ /dev/null @@ -1,30 +0,0 @@ -use substreams_ethereum::pb::eth::v2::{self as eth}; - -use crate::pb::tycho::evm::v1::{Block, Transaction}; - -impl From for Block { - fn from(block: eth::Block) -> Self { - Self { - hash: block.hash.clone(), - parent_hash: block - .header - .as_ref() - .expect("Block header not present") - .parent_hash - .clone(), - number: block.number, - ts: block.timestamp_seconds(), - } - } -} - -impl From<ð::TransactionTrace> for Transaction { - fn from(tx: ð::TransactionTrace) -> Self { - Self { - hash: tx.hash.clone(), - from: tx.from.clone(), - to: tx.to.clone(), - index: tx.index.into(), - } - } -}