refactor(uniswap_v4): remove costly clone calls (#169)

* Removed costly `TransactionTrace` clones calls and `.clone()` at a few other places

* style: formatting

* chore: bump uniswap v4 versions to 0.2.1

* fix: fix double referencing

---------

Co-authored-by: Matthieu Vachon <matt@streamingfast.io>
This commit is contained in:
Louise Poole
2025-03-04 16:51:13 +02:00
committed by GitHub
parent 04d14db719
commit f13c1c263b
9 changed files with 55 additions and 58 deletions

View File

@@ -23,11 +23,15 @@ pub fn map_events(
.into_iter()
.filter(|tx| tx.status == 1)
.flat_map(|tx| {
tx.clone()
let receipt = tx
.receipt
.into_iter()
.flat_map(|receipt| receipt.logs)
.filter_map(|log| log_to_event(&log, tx.clone(), &pools_store))
.as_ref()
.expect("all transaction traces have a receipt");
receipt
.logs
.iter()
.filter_map(|log| log_to_event(log, &tx, &pools_store))
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
@@ -39,7 +43,7 @@ pub fn map_events(
fn log_to_event(
event: &Log,
tx: TransactionTrace,
tx: &TransactionTrace,
pools_store: &StoreGetProto<Pool>,
) -> Option<PoolEvent> {
if let Some(init) = Initialize::match_and_decode(event) {