refactor(substreams): refactor uniswapv2 to use tycho-substreams
This commit is contained in:
@@ -7,14 +7,9 @@ use substreams_ethereum::pb::eth::v2::{self as eth};
|
||||
|
||||
use substreams_helper::{event_handler::EventHandler, hex::Hexable};
|
||||
|
||||
use crate::{
|
||||
abi::factory::events::PairCreated,
|
||||
pb::tycho::evm::v1::{
|
||||
Attribute, Block, BlockChanges, ChangeType, EntityChanges, FinancialType,
|
||||
ImplementationType, ProtocolComponent, ProtocolType, Transaction, TransactionChanges,
|
||||
},
|
||||
};
|
||||
use crate::abi::factory::events::PairCreated;
|
||||
|
||||
use tycho_substreams::prelude::*;
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Params {
|
||||
factory_address: String,
|
||||
@@ -32,7 +27,7 @@ pub fn map_pools_created(
|
||||
|
||||
get_pools(&block, &mut new_pools, ¶ms);
|
||||
|
||||
let tycho_block: Block = block.into();
|
||||
let tycho_block: Block = (&block).into();
|
||||
|
||||
Ok(BlockChanges { block: Some(tycho_block), changes: new_pools })
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
use substreams::store::{StoreNew, StoreSetIfNotExists, StoreSetIfNotExistsProto};
|
||||
|
||||
use crate::{
|
||||
pb::tycho::evm::v1::{BlockChanges, ProtocolComponent},
|
||||
store_key::StoreKey,
|
||||
};
|
||||
use crate::store_key::StoreKey;
|
||||
use tycho_substreams::prelude::*;
|
||||
|
||||
#[substreams::handlers::store]
|
||||
pub fn store_pools(
|
||||
|
||||
@@ -5,18 +5,8 @@ use substreams_ethereum::pb::eth::v2::{self as eth};
|
||||
|
||||
use substreams_helper::{event_handler::EventHandler, hex::Hexable};
|
||||
|
||||
use crate::{
|
||||
abi::pool::events::Sync,
|
||||
pb::tycho::evm::{
|
||||
v1,
|
||||
v1::{
|
||||
Attribute, BalanceChange, BlockChanges, ChangeType, EntityChanges, ProtocolComponent,
|
||||
TransactionChanges,
|
||||
},
|
||||
},
|
||||
store_key::StoreKey,
|
||||
traits::PoolAddresser,
|
||||
};
|
||||
use crate::{abi::pool::events::Sync, store_key::StoreKey, traits::PoolAddresser};
|
||||
use tycho_substreams::prelude::*;
|
||||
|
||||
// Auxiliary struct to serve as a key for the HashMaps.
|
||||
#[derive(Clone, Hash, Eq, PartialEq)]
|
||||
@@ -33,7 +23,7 @@ impl<T> ComponentKey<T> {
|
||||
|
||||
#[derive(Clone)]
|
||||
struct PartialChanges {
|
||||
transaction: v1::Transaction,
|
||||
transaction: Transaction,
|
||||
entity_changes: HashMap<ComponentKey<String>, Attribute>,
|
||||
balance_changes: HashMap<ComponentKey<Vec<u8>>, BalanceChange>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user