All packages

polymarket-collateral
colindickson
Package ref
polymarket-collateral@v0.12.0Run package
CLI
Run map_pusd_events from the command line.
substreams run polymarket-collateral@v0.12.0 map_pusd_events -e polygon --start-block -1Authenticate by running
substreams auth or directly on thegraph.market (see docs).README
Polymarket Collateral Substreams Package
Substreams package for extracting pUSD collateral-token and CTF collateral-adapter events from Polymarket on Polygon.
Contract Information
- Network: Polygon
- Initial Block: 84902320
| Contract | Address |
|---|---|
| pUSD | 0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB |
| CtfCollateralAdapter | 0xAdA100Db00Ca00073811820692005400218FcE1f |
| NegRiskCtfCollateralAdapter | 0xadA2005600Dec949baf300f4C6120000bDB6eAab |
Available Modules
| Module | Description | Output Type |
|---|---|---|
map_pusd_events | Extracts pUSD collateral-token events | proto:polymarket.collateral.v1.PusdEvents |
map_ctf_adapter_events | Extracts CtfCollateralAdapter events | proto:polymarket.collateral.v1.CtfAdapterEvents |
map_neg_risk_ctf_adapter_events | Extracts NegRiskCtfCollateralAdapter events | proto:polymarket.collateral.v1.NegRiskCtfAdapterEvents |
map_all_events | Extracts all collateral events | proto:polymarket.collateral.v1.AllEvents |
Quick Start
Build the WASM binary:
make build-collateral
# or
cd polymarket-collateral && substreams build
Create the Substreams package:
cd polymarket-collateral && substreams pack
Run the Substreams:
substreams run substreams.yaml map_all_events \
--network polygon \
--start-block 84902320 \
--stop-block +1000
Event Types
The package extracts the following event categories:
pUSD Events
Transfer- pUSD token transferWrapped- Collateral wrapped into pUSDUnwrapped- pUSD unwrapped back to collateral
CTF Collateral Adapter Events
PositionSplit- Collateral split into conditional positionsPositionsMerged- Conditional positions merged back to collateralPositionsRedeemed- Winning positions redeemed for collateral
NegRisk CTF Collateral Adapter Events
PositionSplit- Collateral split into conditional positionsPositionsMerged- Conditional positions merged back to collateralPositionsRedeemed- Winning positions redeemed for collateralPositionsConverted- Neg-risk positions converted across outcomes
Dependencies
substreams: ^0.7substreams-ethereum: ^0.11ethabi: ^18
Binary Output
Build artifacts: target/wasm32-unknown-unknown/release/polymarket_collateral.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
