This commit is contained in:
0xMochan
2024-03-22 14:34:08 -04:00
parent ef098f8238
commit 2a85ca849b
2 changed files with 38 additions and 5 deletions

View File

@@ -16,9 +16,9 @@ const MAIN_REGISTRY: [u8; 20] = hex!("90E00ACe148ca3b23Ac1bC8C240C2a7Dd9c2d7f5")
const CRYPTO_POOL_FACTORY: [u8; 20] = hex!("F18056Bbd320E96A48e3Fbf8bC061322531aac99");
const META_POOL_FACTORY: [u8; 20] = hex!("B9fC157394Af804a3578134A6585C0dc9cc990d4");
/// This trait defines some helpers for serializing and deserializing `Vec<BigInt` which is needed
/// to be able to encode the `normalized_weights` and `weights` `Attribute`s. This should also be
/// handled by any downstream application.
/// This trait defines some helpers for serializing and deserializing `Vec<BigInt>` which is needed
/// to be able to encode some of the `Attribute`s. This should also be handled by any downstream
/// application.
trait SerializableVecBigInt {
fn serialize_bytes(&self) -> Vec<u8>;
fn deserialize_bytes(bytes: &[u8]) -> Vec<BigInt>;

View File

@@ -22,7 +22,7 @@ use substreams_ethereum::Event;
use crate::{abi, contract_changes, pb};
const FACTORY: [u8; 20] = hex!("5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f");
const FACTORY: [u8; 20] = hex!("Eb6625D65a0553c9dBc64449e56abFe519bd9c9B");
// struct BinDelta {
// delta_a: BigInt,
@@ -68,7 +68,7 @@ pub fn map_pools_created(
.logs_with_calls()
.filter(|(_, call)| !call.call.state_reverted)
.filter(|(log, _)| log.address == FACTORY)
.filter_map(|(log, call)| {
.filter_map(|(log, _)| {
let pool_added = abi::factory::events::PoolCreated::match_and_decode(log)?;
log::info!("tacos");
@@ -416,3 +416,36 @@ pub fn map_changes(
.collect::<Vec<_>>(),
})
}
// #[substreams::handlers::map]
// pub fn debug_block_events(block: eth::v2::Block) -> Result<tycho::BlockContractChanges> {
// log::info!("Block: {:?}", block);
// Ok(tycho::BlockContractChanges {
// block: Some(tycho::Block {
// number: block.number,
// hash: block.hash.clone(),
// parent_hash: block
// .header
// .as_ref()
// .expect("Block header not present")
// .parent_hash
// .clone(),
// ts: block.timestamp_seconds(),
// }),
// changes: transaction_contract_changes
// .drain()
// .sorted_unstable_by_key(|(index, _)| index.clone())
// .filter_map(|(_, change)| {
// if change.contract_changes.is_empty()
// && change.component_changes.is_empty()
// && change.balance_changes.is_empty()
// {
// None
// } else {
// Some(change)
// }
// })
// .collect::<Vec<_>>(),
// })
// }