Package Logo
polymarket-ctf
polymarket-ctf@v0.10.0
Total Downloads
14
Published
4 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

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

map
map_erc1155_events

f8982b79ae7d8ffab3e6fb07f06d60467dcf035d
substreams gui polymarket-ctf@v0.10.0 map_erc1155_events

map
map_all_events

a234976690a1ff25f716991a07617bb5dc30d716
substreams gui polymarket-ctf@v0.10.0 map_all_events

map
eth_common:all_events

433686393b184c57628660f7dbe6cfed4d72a9e9
map eth_common:all_events (
)  -> sf.substreams.ethereum.v1.Events

all_events gives you all the events in a block (from successful transactions), with basic block hash/number/timestamp and transaction hash

substreams gui polymarket-ctf@v0.10.0 eth_common:all_events
Block Indexes icon
Block Indexes

blockIndex
eth_common:index_events

8375ddd2cb44363ab1691748ecb6303603f29568

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)
substreams gui polymarket-ctf@v0.10.0 eth_common:index_events
Protobuf

Protobuf Docs Explorer

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