fix: further fixes

This commit is contained in:
0xMochan
2024-04-01 14:53:17 -05:00
parent 462cd29b49
commit 373ac1036c
3 changed files with 8 additions and 9 deletions

View File

@@ -164,18 +164,16 @@ pub fn map_relative_balances(
let event = abi::pool::events::AddLiquidity::match_and_decode(log)?;
Some((log, event))
})
.filter(|(log, _)| {
pools_store
.get_last(format!("pool:{0}", hex::encode(&log.address())))
.is_none()
})
.flat_map(|(log, event)| {
.filter_map(|(log, event)| {
let tokens = tokens_store
.get_last(format!("pool:{}", hex::encode(log.address())))
.unwrap()
.get_last(format!("pool:{0}", hex::encode(log.address())))?
.split(":")
.map(|token| token.to_owned()) // Clone the tokens
.collect::<Vec<_>>();
Some((tokens, log, event))
})
.flat_map(|(tokens, log, event)| {
event
.token_amounts
.iter()

View File

@@ -20,6 +20,7 @@ const META_POOL_FACTORY: [u8; 20] = hex!("B9fC157394Af804a3578134A6585C0dc9cc990
/// 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.
#[allow(dead_code)]
trait SerializableVecBigInt {
fn serialize_bytes(&self) -> Vec<u8>;
fn deserialize_bytes(bytes: &[u8]) -> Vec<BigInt>;

View File

@@ -23,7 +23,7 @@ modules:
inputs:
- source: sf.ethereum.type.v2.Block
output:
type: proto:tycho.evm.v1.GroupedTransactionProtocolComponents
type: proto:tycho.evm.v1.BlockTransactionProtocolComponents
- name: store_components
kind: store