#!/usr/bin/env python3
"""
Decode custom error selector
"""
from eth_utils import keccak

# Common ApolloX errors to try
possible_errors = [
    "NotTradeOwner()",
    "TradeNotExists()",
    "TradeClosed()",
    "TradeExpired()",
    "Unauthorized()",
    "InvalidTrade()",
    "PositionClosed()",
    "PositionNotFound()",
    "NotOwner()",
    "TradeNotActive()",
    "AlreadyClosed()",
]

target_selector = "0x7f426257"

print("="*80)
print(f"🔍 DECODING ERROR SELECTOR: {target_selector}")
print("="*80)

for error in possible_errors:
    selector = '0x' + keccak(text=error).hex()[:8]
    match = "✅ MATCH!" if selector == target_selector else ""
    print(f"   {selector}: {error} {match}")

print("\n" + "="*80)
