from web3 import Web3 from web3.middleware import geth_poa_middleware
# 检测是否有人购买某种币种 defcheck_buy_coin(data): if data isNone: returnFalse try: transactions = data.transactions for transaction in transactions: try: tx = Web3.toHex(transaction.hash).lower() info = transaction.input method = info[:10] if method in ["0x38ed1739", "0x8803dbee", "0x7ff36ab5", "0xfb3bdb41"]: print(f"one buy this coin tx is {tx}") returnTrue except Exception as e: print(f"latest check_buy_coin in is error") print(traceback.format_exc()) continue returnFalse except Exception as e: print(f"latest check_buy_coin is error") print(traceback.format_exc())