All packages

polymarket-exchange
colindickson
Package ref
polymarket-exchange@v0.12.0Run package
CLI
Run map_exchange_events from the command line.
substreams run polymarket-exchange@v0.12.0 map_exchange_events -e polygon --start-block -1Authenticate by running
substreams auth or directly on thegraph.market (see docs).README
Polymarket Exchange Substreams Package
Substreams package for extracting events from the Polymarket CTF Exchange contract on Polygon.
Contract Information
- Address:
0xE111180000d2663C0091e4f400237545B87B996B - Network: Polygon
- Explorer: View on Polygonscan
Available Modules
| Module | Description | Output Type |
|---|---|---|
map_exchange_events | Extracts exchange trading events | proto:polymarket.exchange.v1.ExchangeEvents |
map_fee_events | Extracts fee-related events | proto:polymarket.exchange.v1.FeeEvents |
map_admin_events | Extracts admin role events | proto:polymarket.exchange.v1.AdminEvents |
map_pause_events | Extracts user pause events | proto:polymarket.exchange.v1.PauseEvents |
map_approval_events | Extracts order approval events | proto:polymarket.exchange.v1.OrderApprovalEvents |
map_all_events | Extracts all exchange events | proto:polymarket.exchange.v1.AllEvents |
Quick Start
Build the WASM binary:
make build-exchange
# or
cd polymarket-exchange && substreams build
Create the Substreams package:
cd polymarket-exchange && substreams pack
Run the Substreams:
substreams run substreams.yaml map_all_events \
--network polygon \
--start-block -1000
Event Types
The package extracts the following V2 event categories:
Exchange Events
OrderFilled- Order filled (withsideuint8,token_id,builder,metadata)OrdersMatched- Orders matched (withsideuint8,token_id)
Fee Events
FeeCharged- Trading fee charged (recipient,amount)FeeReceiverUpdated- Fee receiver address changedMaxFeeRateUpdated- Maximum fee rate changed
Admin Events
NewAdmin- New admin addedNewOperator- New operator addedRemovedAdmin- Admin removedRemovedOperator- Operator removed
Pause Events
UserPaused- User paused from tradingUserUnpaused- User unpausedUserPauseBlockIntervalUpdated- Pause interval changed
Order Approval Events
OrderPreapproved- Order preapprovedOrderPreapprovalInvalidated- Order preapproval invalidated
Dependencies
substreams: ^0.7substreams-ethereum: ^0.11ethabi: ^18
Binary Output
Build artifacts: target/wasm32-unknown-unknown/release/polymarket_exchange.wasm
Modules
Execution graph
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
