Package Logo
polymarket-ctf
polymarket-ctf@v0.7.0
Total Downloads
12
Published
1 hours ago
Network
polygon polygon
Publisher
User Avatar colindickson

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:

make package-ctf
# or
cd polymarket-ctf && substreams pack

Run the Substreams:

make run-ctf
# or
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 prepared
  • ConditionResolution - Condition resolved with payout numerators
  • PositionSplit - Collateral split into conditional positions
  • PositionsMerge - Conditional positions merged back to collateral
  • PayoutRedemption - Winning positions redeemed for collateral

ERC-1155 Events

  • TransferBatch - Batch transfer of tokens
  • TransferSingle - Single token transfer
  • ApprovalForAll - Approval for all operator

Dependencies

  • substreams: ^0.7
  • substreams-ethereum: ^0.11
  • ethabi: ^18

Binary Output

Build artifacts: target/wasm32-unknown-unknown/release/polymarket_ctf.wasm

Documentation

Modules

Maps icon
Maps

map
map_ctf_events

0059903291f108e15b4c4470c5641577e21d12ef
map map_ctf_events (
blocksf.ethereum.type.v2.Block
)  -> polymarket.ctf.v1.CtfEvents
substreams gui polymarket-ctf@v0.7.0 map_ctf_events

map
map_erc1155_events

3376ccad1a6616f4470184557c423b783f7d52ed
substreams gui polymarket-ctf@v0.7.0 map_erc1155_events

map
map_all_events

9b9590b30fdcc1d1115f3bb4ddf8d79c2c7cd31b
substreams gui polymarket-ctf@v0.7.0 map_all_events
Block Indexes icon
Block Indexes

blockIndex
index_events

c304a7df8249245aa462355e38cd5f8b379ed3a5
blockIndex index_events (
)  -> sf.substreams.index.v1.Keys

Emits evt_addr:<address> for every block containing a CTF contract log, letting downstream modules skip blocks that never touch the contract.

substreams gui polymarket-ctf@v0.7.0 index_events
Protobuf

Protobuf Docs Explorer

polymarket.ctf.v1
sf.ethereum.type.v2
sf.ethereum.substreams.v1
sf.ethereum.transform.v1