All packages
coldcascade

coldcascade

reymom
v0.1.0/2 downloads/Repository

Package ref

coldcascade@v0.1.0

Run package

CLI

Run desk_events from the command line.

substreams run coldcascade@v0.1.0 desk_events -e hyperevm --start-block -1
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

coldcascade substreams

The desk's own record, off HyperEVM blocks.

coldcascade is a 1inch Aqua maker program on chain 999 that prices against Hyperliquid's L1 order book inside the swap. Every fill it makes therefore carries the book it filled against, in the same log — bid, ask, mark and oracle as CoreQuote read them while pricing that swap.

That is the whole reason this package exists. The markout of a fill is the move of L1 mid between the instant the desk quoted and some later instant, signed from the maker's side. The left-hand side of that join is in the Fill. The right-hand side has to come from a Booked, because the HyperCore precompiles ignore the block tag: an eth_call to 0x080e pinned two hundred thousand blocks back answers with the current book. They are node state, not chain state, so there is no archive read and no way to ask what the book was. BookCache.poke writes the four words into a log while they are current, and this package is what reads them back.

Modules

index_desk_eventsone key per contract that spoke in a block
desk_eventsFill, Booked, MapUpdated and Markout, decoded, one message per block

desk_events filters on the index. The desk went live at block 45 135 453; a scan to head is a quarter of a million HyperEVM blocks, of which a couple of dozen contain anything of ours.

Build

cargo build --release --target wasm32-unknown-unknown
substreams pack substreams.yaml

Run

Against The Graph Market for Substreams, whose HyperEVM endpoint is Pinax's:

export SUBSTREAMS_API_TOKEN=...
substreams run -e hyperevm.substreams.pinax.network:443 \
  coldcascade-v0.1.0.spkg desk_events -s 45135453 -t 0 --limit-processed-blocks 0

keeper/coldcascade/markouts.py consumes exactly that, joins each fill to the books that follow it, and posts the result to MarkoutLedger — whose Markout log this same package then decodes.

Decoding

Written out rather than generated. All four events are static ABI — no dynamic field in any of them — so the decode is fixed offsets, and a codegen step would be one more thing that can silently disagree with the contracts in src/. The topic hashes are keccak of the signatures and are checked against cast keccak output in the same session they were written.

Modules

Execution graph

2 modules
mapMain

desk_events

Fills, books, maps and markouts from the four coldcascade contracts on chain 999, decoded into one message per block. Blocks with none of them are not emitted.

from #45135453
blockIndex

index_desk_events

One key per contract that spoke in this block. The desk went live at 45135453 and the chain is at 45.3M, so a full scan is a quarter of a million blocks of which a handful contain anything of ours. The index lets the endpoint skip the rest.

from #45135453

Output

sf.substreams.index.v1.Keys