Skip to main content
Cross-chain support allows bridging and SFP outcome token minting on L2s (e.g. Base, Polygon) for Polymarket-style prediction markets. When CROSS_CHAIN_ENABLED=true, the bridge API and outcome token contract can be used by BridgeService and related APIs (see roadmap).

1. Overview

Code: CrossChainTransaction model (app/db/models.py) and migration a1c2d3e4f5b6_add_cross_chain_transactions. When implemented: BridgeService, blockchain_service.mint_outcome_token, GET /cross-chain/transactions, GET /bridge/status, POST /outcome-tokens/mint. Config: app/core/config.py.

2. Configuration


3. CrossChainTransaction model


4. Chain IDs (examples)

Set OUTCOME_TOKEN_CHAIN_ID to the chain where the SFP outcome token contract is deployed. RPC for that chain must be available (e.g. via X402_NETWORK_RPC_URL when that is the active network, or a dedicated RPC if the app supports it).

5. Bridge API

POLYMARKET_BRIDGE_API_URL should point to an API that supports at least:
  • Status: GET {base}/bridge/status/{bridge_id}BridgeService.get_bridge_status(bridge_id) calls this. Returns JSON with at least status (and optionally dest_tx_hash, bridge_id, etc.).
  • Submit: POST {base}/bridge/submitBridgeService.submit_bridge(...) sends JSON: source_chain_id, dest_chain_id, amount, token_address, sender_address, and optionally market_event_id, outcome_token_id, receiver_address, extra. The API should return e.g. { "bridge_id": "...", "status": "submitted" }.
Exact request/response shapes depend on the Polymarket bridge or your custom relay. BridgeService (app/services/bridge_service.py) implements the above; adapt the service or base URL path if your relay uses different conventions.

6. SFP Outcome Token (ERC-1155)

SFPOutcomeToken.sol (contracts/contracts/SFPOutcomeToken.sol) is an ERC-1155 with mint(to, outcomeTokenId, amount, data) and mintBatch (owner-only). Deploy it on OUTCOME_TOKEN_CHAIN_ID and set SFP_OUTCOME_TOKEN_CONTRACT. blockchain_service.mint_outcome_token(recipient_address, outcome_token_id, amount, data) calls mint; it requires CROSS_CHAIN_ENABLED, SFP_OUTCOME_TOKEN_CONTRACT, and BLOCKCHAIN_DEPLOYER_PRIVATE_KEY (or deployer from BLOCKCHAIN_AUTO_DEPLOY). The Web3 RPC is X402_NETWORK_RPC_URL—use the node for OUTCOME_TOKEN_CHAIN_ID when minting.

7. Example .env


  • Polymarket (SFP markets): POLYMARKET_ENABLED, POLYMARKET_API_URL, POLYMARKET_GAMMA_API_URL, etc. — for internal SFP prediction markets and optional Gamma/CLOB. See dev/POLYMARKET_CONFIGURATION_GUIDE.md or .env.example if present.
  • Polymarket Surveillance: Polymarket Surveillance SignalsPOLYMARKET_DATA_API_URL, POLYMARKET_SURVEILLANCE_ENABLED.
  • Blockchain / RPC: X402_NETWORK_RPC_URL, BLOCKCHAIN_DEPLOYER_PRIVATE_KEY — used for on-chain calls including outcome token minting when wired.