Skip to content

Commit

Permalink
add copium kickbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Aug 21, 2024
1 parent 97d0d8f commit be76322
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 16 additions & 6 deletions src/monitoring_tests/mev_blocker_kickbacks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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)
Expand Down

0 comments on commit be76322

Please sign in to comment.