refactor(substreams): refactor uniswapv3 to use tycho-substreams
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<Pool>) {
|
||||
|
||||
@@ -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<TransactionChanges> = 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 };
|
||||
|
||||
Reference in New Issue
Block a user