32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
from web3 import Web3
|
||
|
||
RPC_URL = "https://polygon-rpc.com"
|
||
MY_ADDRESS = "0xADcA20376A6CdCBd232577ac830F4116eC863DcF"
|
||
|
||
# 两个不同的 USDC 地址
|
||
USDC_E_ADDR = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" # 桥接版 (Polymarket用这个)
|
||
USDC_NATIVE_ADDR = "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" # 原生版
|
||
|
||
w3 = Web3(Web3.HTTPProvider(RPC_URL))
|
||
abi = [{"constant": True, "inputs": [{"name": "_owner", "type": "address"}], "name": "balanceOf",
|
||
"outputs": [{"name": "balance", "type": "uint256"}], "type": "function"}]
|
||
|
||
|
||
def check():
|
||
# 检查 USDC.e
|
||
c_e = w3.eth.contract(address=w3.to_checksum_address(USDC_E_ADDR), abi=abi)
|
||
bal_e = c_e.functions.balanceOf(MY_ADDRESS).call() / 1e6
|
||
|
||
# 检查 原生 USDC
|
||
c_n = w3.eth.contract(address=w3.to_checksum_address(USDC_NATIVE_ADDR), abi=abi)
|
||
bal_n = c_n.functions.balanceOf(MY_ADDRESS).call() / 1e6
|
||
|
||
print(f"💰 桥接版 USDC.e (旧): {bal_e} USDC")
|
||
print(f"💰 原生版 USDC (新): {bal_n} USDC")
|
||
|
||
if bal_n > 0 and bal_e == 0:
|
||
print("\n⚠️ 发现原因:你的 USDC 是新版原生币,Polymarket 不支持!")
|
||
print("💡 解决方法:在 OKX 钱包里使用 Swap 功能,把 USDC 兑换成 USDC.e")
|
||
|
||
|
||
check() |