All packages
polymarket-ctf

polymarket-ctf

colindickson
v1.2.0/30 downloads/Repository

Package ref

polymarket-ctf@v1.2.0

Run package

Start block
latest 200 blocks

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

ModuleDescriptionOutput Type
map_ctf_eventsExtracts CTF-specific eventsproto:ctf.v1.CtfEvents
map_erc1155_eventsExtracts ERC-1155 token eventsproto:ctf.v1.Erc1155Events
map_all_eventsExtracts all CTF and ERC-1155 eventsproto: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 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.8
  • substreams-ethereum: ^0.12
  • buffa: 0.9

Binary Output

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

Modules

Execution graph

5 modules
Show 2 dependencies
map

eth_common:all_events

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

Output

sf.substreams.ethereum.v1.Events

blockIndex

eth_common:index_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