From be763227ed42e4a59779170cc1ecc862306eec8d Mon Sep 17 00:00:00 2001 From: harisang Date: Wed, 21 Aug 2024 13:26:14 +0300 Subject: [PATCH] add copium kickbacks --- src/constants.py | 3 ++- .../mev_blocker_kickbacks_test.py | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/constants.py b/src/constants.py index 07e1dd9..b5f5c98 100644 --- a/src/constants.py +++ b/src/constants.py @@ -39,7 +39,8 @@ # relevant addresses SETTLEMENT_CONTRACT_ADDRESS = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41" -MEV_BLOCKER_KICKBACKS_ADDRESS = "0xCe91228789B57DEb45e66Ca10Ff648385fE7093b" +COW_DAO_MEV_BLOCKER_KICKBACKS_ADDRESS = "0xCe91228789B57DEb45e66Ca10Ff648385fE7093b" +COPIUM_MEV_BlOCKER_KICKBACKS_ADDRESS = "0x008300082C3000009e63680088f8c7f4D3ff2E87" # requests REQUEST_TIMEOUT = 5 diff --git a/src/monitoring_tests/mev_blocker_kickbacks_test.py b/src/monitoring_tests/mev_blocker_kickbacks_test.py index e5573a0..1d3a64a 100644 --- a/src/monitoring_tests/mev_blocker_kickbacks_test.py +++ b/src/monitoring_tests/mev_blocker_kickbacks_test.py @@ -7,7 +7,8 @@ from src.monitoring_tests.base_test import BaseTest from src.apis.web3api import Web3API from src.constants import ( - MEV_BLOCKER_KICKBACKS_ADDRESS, + COW_DAO_MEV_BLOCKER_KICKBACKS_ADDRESS, + COPIUM_MEV_BLOCKER_KICKBACKS_ADDRESS, KICKBACKS_ALERT_THRESHOLD, ) @@ -31,19 +32,28 @@ def run(self, tx_hash: str) -> bool: if block_number is None: return False - total_eth_kickbacks = self.web3_api.get_eth_transfers_by_block_range( - block_number, block_number, MEV_BLOCKER_KICKBACKS_ADDRESS + cow_dao_total_eth_kickbacks = self.web3_api.get_eth_transfers_by_block_range( + block_number, block_number, COW_DAO_MEV_BLOCKER_KICKBACKS_ADDRESS ) - if total_eth_kickbacks is None: + copium_total_eth_kickbacks = self.web3_api.get_eth_transfers_by_block_range( + block_number, block_number, COPIUM_MEV_BLOCKER_KICKBACKS_ADDRESS + ) + eth_kickbacks = None + if cow_dao_total_eth_kickbacks is not None: + eth_kickbacks = cow_dao_total_eth_kickbacks + if copium_total_eth_kickbacks is not None: + eth_kickbacks = copium_total_eth_kickbacks + + if eth_kickbacks is None: return False log_output = "\t".join( [ "MEV Blocker kickbacks test:", f"Tx Hash: {tx_hash}", - f"Kickback: {total_eth_kickbacks:.5f}ETH", + f"Kickback: {eth_kickbacks:.5f}ETH", ] ) - if total_eth_kickbacks >= KICKBACKS_ALERT_THRESHOLD: + if eth_kickbacks >= KICKBACKS_ALERT_THRESHOLD: self.alert(log_output) else: self.logger.info(log_output)