Extracts CTF-specific events (ConditionPreparation, ConditionResolution, PositionSplit, PositionsMerge, PayoutRedemption).

polymarket-ctf
Package ref
polymarket-ctf@v0.13.0Run package
CLI
Run map_ctf_events from the command line.
substreams run polymarket-ctf@v0.13.0 map_ctf_events -e polygon --start-block -1substreams auth or directly on thegraph.market (see docs).README
Polymarket CTF Substreams Package
Substreams package for extracting events from the Polymarket Conditional Tokens Framework (CTF) contract on Polygon.
Contract Information
- Address:
0x4D97DCd97eC945f40cF65F87097ACe5EA0476045 - Network: Polygon
- Explorer: View on Polygonscan
Available Modules
| Module | Description | Output Type |
|---|---|---|
map_ctf_events | Extracts CTF-specific events | proto:ctf.v1.CtfEvents |
map_erc1155_events | Extracts ERC-1155 token events | proto:ctf.v1.Erc1155Events |
map_all_events | Extracts all CTF and ERC-1155 events | proto:ctf.v1.AllEvents |
Quick Start
Build the WASM binary:
make build-ctf
# or
cd polymarket-ctf && substreams build
Create the Substreams package:
cd polymarket-ctf && substreams pack
Run the Substreams:
substreams run substreams.yaml map_all_events \
--network polygon \
--start-block -1000
Event Types
The package extracts the following event categories:
CTF Events
ConditionPreparation- New prediction market condition preparedConditionResolution- Condition resolved with payout numeratorsPositionSplit- Collateral split into conditional positionsPositionsMerge- Conditional positions merged back to collateralPayoutRedemption- Winning positions redeemed for collateral
ERC-1155 Events
TransferBatch- Batch transfer of tokensTransferSingle- Single token transferApprovalForAll- Approval for all operator
Dependencies
substreams: ^0.7substreams-ethereum: ^0.11ethabi: 17
Binary Output
Build artifacts: target/wasm32-unknown-unknown/release/polymarket_ctf.wasm
Modules
Execution graph
Extracts ERC-1155 token events (TransferSingle, TransferBatch, ApprovalForAll) from the CTF contract.
Show 2 dependencies
Output
sf.substreams.ethereum.v1.Events
`index_events` sets the following keys on the block: * Event signatures evt_sig:0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef (signature in hex, prefixed by 0x) * Event address evt_addr:0x0123456789abcdef0123456789abcdef01234567 (address in hex, prefixed by 0x)
Output
sf.substreams.index.v1.Keys
Inputs
