Documentation Index
Fetch the complete documentation index at: https://docs-t.aionmarket.com/llms.txt
Use this file to discover all available pages before exploring further.
This guide explains how to authorize a Deposit Wallet (signatureType=3) for Polymarket trading. Deposit Wallets are one of four supported wallet types; only Deposit Wallets require 12 on-chain approvals on Polygon before any trade can be executed. EOA / Proxy / Gnosis Safe wallets do not need this step and can trade immediately after registering credentials.
This guide applies only to wallets registered with signatureType=3. If your wallet is signatureType=0 (EOA), 1 (POLY_PROXY), or 2 (GNOSIS_SAFE), skip this guide entirely — those wallets can place orders without any on-chain approval flow.
Background
Polymarket V2 uses multiple smart contracts on Polygon for order execution, settlement, and redemption:
- CTF Exchange (V2) — the main order book and matching engine
- Neg Risk Exchange A & B (V2) — handles negatively-correlated multi-outcome markets
- Neg Risk Adapter — bridges collateral for neg-risk markets
- PolyNode Fee Escrow — holds escrowed maker fees
- CTF Collateral Adapter — converts pUSD ↔ Conditional Tokens for redemption
- Neg Risk CTF Collateral Adapter — same for neg-risk markets
Each contract needs permission to move tokens on behalf of the wallet. There are two token types:
| Token | Address | Type | Approval Method |
|---|
| pUSD | 0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB | ERC-20 | approve(spender, amount) |
| CTF (Conditional Tokens) | 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045 | ERC-1155 | setApprovalForAll(operator, true) |
Workflow
Step 1 — Check Authorization Status
from aion_sdk import AionMarketClient
client = AionMarketClient(
api_key="YOUR_API_KEY",
base_url="https://pm-t1.bxingupdate.com/bvapi",
)
status = client.get_wallet_audit_status("0xYOUR_DEPOSIT_WALLET")
print(status)
# {"walletAddress": "0x...", "auditsStatus": 0, "auditsStatusText": "未授权"}
auditsStatus | Meaning | Next Step |
|---|
0 | Not authorized | Proceed to Step 2 |
1 | Fully authorized | Skip to trading |
Step 2 — Get the 12 Approval Items
audit_items = client.get_wallet_audit_items()
print(f"Total: {audit_items['total']}") # 12
for item in audit_items["items"]:
print(f"{item['audit_name']} → {item['method']}")
The response contains 12 items. Each item specifies:
| Field | Description |
|---|
audit_name | Human-readable name (e.g. "pUSD → CTF Exchange (V2)") |
audit_item_code | Short code (e.g. "PUCE") |
token_contract | The token contract to call approve / setApprovalForAll on |
spender_contract | The address to approve as spender / operator |
method | "approve" for ERC-20 or "setApprovalForAll" for ERC-1155 |
check_method | "allowance" or "isApprovedForAll" — how to verify on-chain |
Step 3 — Execute Approvals On-Chain
The agent uses the user’s Polygon private key to sign and broadcast each approval transaction:
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://polygon-rpc.com"))
account = w3.eth.account.from_key(WALLET_PRIVATE_KEY)
ERC20_ABI = [
{
"inputs": [
{"name": "spender", "type": "address"},
{"name": "amount", "type": "uint256"}
],
"name": "approve",
"outputs": [{"name": "", "type": "bool"}],
"stateMutability": "nonpayable",
"type": "function"
}
]
ERC1155_ABI = [
{
"inputs": [
{"name": "operator", "type": "address"},
{"name": "approved", "type": "bool"}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
MAX_UINT256 = 2**256 - 1
audit_items = client.get_wallet_audit_items()
for item in audit_items["items"]:
token = w3.to_checksum_address(item["token_contract"])
spender = w3.to_checksum_address(item["spender_contract"])
if item["method"] == "approve":
contract = w3.eth.contract(address=token, abi=ERC20_ABI)
tx = contract.functions.approve(spender, MAX_UINT256).build_transaction({
"from": account.address,
"nonce": w3.eth.get_transaction_count(account.address),
"gas": 100_000,
"gasPrice": w3.eth.gas_price,
})
else: # setApprovalForAll
contract = w3.eth.contract(address=token, abi=ERC1155_ABI)
tx = contract.functions.setApprovalForAll(spender, True).build_transaction({
"from": account.address,
"nonce": w3.eth.get_transaction_count(account.address),
"gas": 100_000,
"gasPrice": w3.eth.gas_price,
})
signed = account.sign_transaction(tx)
tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"✓ {item['audit_name']} — tx: {tx_hash.hex()}")
Each approval is a separate on-chain transaction and costs Polygon gas (MATIC/POL). Ensure the wallet has sufficient gas balance before starting.
Step 4 — Verify Authorization
After all 12 approvals are broadcast, the platform’s cron job (runs every 30 minutes) will verify them on-chain and update auditsStatus to 1. You can poll the status:
import time
while True:
status = client.get_wallet_audit_status("0xYOUR_DEPOSIT_WALLET")
if status["auditsStatus"] == 1:
print("✓ Wallet fully authorized — ready to trade!")
break
print("Waiting for cron to verify approvals...")
time.sleep(60)
The 12 Approval Items
| # | Name | Token | Spender | Method |
|---|
| 1 | pUSD → CTF Exchange (V2) | pUSD | CTF Exchange V2 | approve |
| 2 | CTF → CTF Exchange (V2) | CTF | CTF Exchange V2 | setApprovalForAll |
| 3 | pUSD → Neg Risk Exchange A (V2) | pUSD | Neg Risk Exchange A | approve |
| 4 | CTF → Neg Risk Exchange A (V2) | CTF | Neg Risk Exchange A | setApprovalForAll |
| 5 | pUSD → Neg Risk Adapter | pUSD | Neg Risk Adapter | approve |
| 6 | CTF → Neg Risk Adapter | CTF | Neg Risk Adapter | setApprovalForAll |
| 7 | pUSD → Neg Risk Exchange B (V2) | pUSD | Neg Risk Exchange B | approve |
| 8 | CTF → Neg Risk Exchange B (V2) | CTF | Neg Risk Exchange B | setApprovalForAll |
| 9 | pUSD → PolyNode Fee Escrow | pUSD | PolyNode Fee Escrow | approve |
| 10 | CTF → CTF Collateral Adapter | CTF | CTF Collateral Adapter | setApprovalForAll |
| 11 | CTF → Neg Risk CTF Collateral Adapter | CTF | Neg Risk CTF Collateral Adapter | setApprovalForAll |
| 12 | pUSD → CTF Collateral Adapter | pUSD | CTF Collateral Adapter | approve |
Important Notes
- Only for Deposit Wallets — wallets registered with
signatureType=3. Other wallet types (EOA, Proxy, Gnosis Safe) do not need these approvals.
- One-time operation — approvals persist on-chain unless explicitly revoked. Once
auditsStatus=1, the wallet is permanently ready to trade.
- Gas cost — all 12 transactions together cost approximately 0.01–0.05 MATIC depending on gas prices.
- Cron verification — the platform verifies approvals on-chain every 30 minutes. No manual status update is needed.
API Reference