From 523603ca86e40c4180ef6102fd1f3439d3aea776 Mon Sep 17 00:00:00 2001 From: kylezs Date: Thu, 28 Sep 2023 14:04:12 +0200 Subject: [PATCH] refactor: dedup deposit_addresses safe eth witnessing --- engine/src/witness/eth.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/engine/src/witness/eth.rs b/engine/src/witness/eth.rs index 7e5529c090..f770ee2e2d 100644 --- a/engine/src/witness/eth.rs +++ b/engine/src/witness/eth.rs @@ -196,6 +196,11 @@ where .shared(scope) .chunk_by_vault(vaults); + let eth_safe_vault_source_deposit_addresses = eth_safe_vault_source + .clone() + .deposit_addresses(scope, state_chain_stream.clone(), state_chain_client.clone()) + .await; + eth_safe_vault_source .clone() .key_manager_witnessing(process_call.clone(), eth_client.clone(), key_manager_address) @@ -214,10 +219,8 @@ where .logging("StateChainGateway") .spawn(scope); - eth_safe_vault_source + eth_safe_vault_source_deposit_addresses .clone() - .deposit_addresses(scope, state_chain_stream.clone(), state_chain_client.clone()) - .await .erc20_deposits::<_, _, _, UsdcEvents>( process_call.clone(), eth_client.clone(), @@ -229,10 +232,8 @@ where .logging("USDCDeposits") .spawn(scope); - eth_safe_vault_source + eth_safe_vault_source_deposit_addresses .clone() - .deposit_addresses(scope, state_chain_stream.clone(), state_chain_client.clone()) - .await .erc20_deposits::<_, _, _, FlipEvents>( process_call.clone(), eth_client.clone(), @@ -244,10 +245,8 @@ where .logging("FlipDeposits") .spawn(scope); - eth_safe_vault_source + eth_safe_vault_source_deposit_addresses .clone() - .deposit_addresses(scope, state_chain_stream.clone(), state_chain_client.clone()) - .await .ethereum_deposits( process_call.clone(), eth_client.clone(),