44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import os
|
|
import sys
|
|
import json
|
|
from web3 import Web3
|
|
from dotenv import load_dotenv
|
|
|
|
# Add project root to sys.path
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
load_dotenv()
|
|
|
|
RPC_URL = os.environ.get("BASE_RPC_URL")
|
|
if not RPC_URL:
|
|
print("Error: BASE_RPC_URL not set")
|
|
sys.exit(1)
|
|
|
|
w3 = Web3(Web3.HTTPProvider(RPC_URL))
|
|
|
|
TX_HASH = "0x40c926a0d792a00d7a549f57f76ccb65c14c49ca7120563ea1229d1dae40457d"
|
|
|
|
def check_tx():
|
|
print(f"Fetching receipt for {TX_HASH}...")
|
|
try:
|
|
receipt = w3.eth.get_transaction_receipt(TX_HASH)
|
|
print(f"Status: {receipt['status']}")
|
|
print(f"Block: {receipt['blockNumber']}")
|
|
print(f"Logs: {len(receipt['logs'])}")
|
|
|
|
for i, log in enumerate(receipt['logs']):
|
|
print(f"--- Log {i} ---")
|
|
print(f"Address: {log['address']}")
|
|
print(f"Topics: {[t.hex() for t in log['topics']]}")
|
|
# Try to decode Swap event?
|
|
# Swap(address sender, address recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick)
|
|
# Topic0: 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67
|
|
if log['topics'][0].hex() == "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67":
|
|
print(">>> SWAP EVENT DETECTED <<<")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
check_tx()
|