Skip to main content

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:
TokenAddressTypeApproval Method
pUSD0xC011a7E12a19f7B1f670d46F03B03f3342E82DFBERC-20approve(spender, amount)
CTF (Conditional Tokens)0x4D97DCd97eC945f40cF65F87097ACe5EA0476045ERC-1155setApprovalForAll(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": "未授权"}
auditsStatusMeaningNext Step
0Not authorizedProceed to Step 2
1Fully authorizedSkip 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:
FieldDescription
audit_nameHuman-readable name (e.g. "pUSD → CTF Exchange (V2)")
audit_item_codeShort code (e.g. "PUCE")
token_contractThe token contract to call approve / setApprovalForAll on
spender_contractThe 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

#NameTokenSpenderMethod
1pUSD → CTF Exchange (V2)pUSDCTF Exchange V2approve
2CTF → CTF Exchange (V2)CTFCTF Exchange V2setApprovalForAll
3pUSD → Neg Risk Exchange A (V2)pUSDNeg Risk Exchange Aapprove
4CTF → Neg Risk Exchange A (V2)CTFNeg Risk Exchange AsetApprovalForAll
5pUSD → Neg Risk AdapterpUSDNeg Risk Adapterapprove
6CTF → Neg Risk AdapterCTFNeg Risk AdaptersetApprovalForAll
7pUSD → Neg Risk Exchange B (V2)pUSDNeg Risk Exchange Bapprove
8CTF → Neg Risk Exchange B (V2)CTFNeg Risk Exchange BsetApprovalForAll
9pUSD → PolyNode Fee EscrowpUSDPolyNode Fee Escrowapprove
10CTF → CTF Collateral AdapterCTFCTF Collateral AdaptersetApprovalForAll
11CTF → Neg Risk CTF Collateral AdapterCTFNeg Risk CTF Collateral AdaptersetApprovalForAll
12pUSD → CTF Collateral AdapterpUSDCTF Collateral Adapterapprove

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