format_matrix_alert
This commit is contained in:
parent
315ff32422
commit
8bd83a28c8
@ -2,7 +2,7 @@ import time
|
||||
from queue import Queue
|
||||
from loguru import logger
|
||||
from web3 import Web3
|
||||
from util import fetch_abi
|
||||
from util import fetch_abi, format_matrix_alert
|
||||
from db import Token, Pair, get_session
|
||||
|
||||
|
||||
@ -122,7 +122,8 @@ class EventMonitor:
|
||||
|
||||
# Add alert to queue
|
||||
logger.info(f"New pair: {token0_address} + {token1_address}")
|
||||
self.queue.put(
|
||||
f"New Uniswap pair: [{token0_info['name']}](https://etherscan.io/address/{token0_address}) +"
|
||||
f"[{token1_info['name']}](https://etherscan.io/address/{token1_address})"
|
||||
formatted_alert = format_matrix_alert(
|
||||
token0={'name': token0_info['name'], 'address': token0_address},
|
||||
token1={'name': token1_info['name'], 'address': token1_address}
|
||||
)
|
||||
self.queue.put(formatted_alert)
|
||||
|
8
util.py
8
util.py
@ -23,3 +23,11 @@ def fetch_abi(address: ChecksumAddress, headers: Optional[Dict[str, Any]] = None
|
||||
def load_config(path: str) -> dict:
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
return json.loads(f.read())
|
||||
|
||||
|
||||
def format_matrix_alert(token0: dict, token1: dict) -> str:
|
||||
return f"""
|
||||
🚨 New Uniswap Pair Alert 🚨\n
|
||||
🌐 **Asset Pair:** [{token0['name']}](https://etherscan.io/token/{token0['address']}) + [{token1['name']}](https://etherscan.io/token/{token1['address']})\n
|
||||
🏠 **Network:** ETH
|
||||
"""
|
Loading…
Reference in New Issue
Block a user