Skip to content

Instantly share code, notes, and snippets.

@sslivkoff
Last active November 26, 2023 04:42
Show Gist options
  • Save sslivkoff/379c98b79ed73d016536502705023ee2 to your computer and use it in GitHub Desktop.
Save sslivkoff/379c98b79ed73d016536502705023ee2 to your computer and use it in GitHub Desktop.
this script collect can be used to collect all events, transactions, call traces, and state diffs associated with Uniswap swaps
# for uniswap v3 swaps, this script will collect all associated...
# - events
# - transactions
# - call traces
# - state diffs
# you can modify the block range and add other args to fit your use case
# note that this script uses cryo command chaining, which allows the output of one command to be used as the input to another
# this allows you to precisely select the subset of data that you want to collect
# 1. collect all uniswap swap events
cryo logs \
--blocks 17_000_000:17_001_000 \
--topic0 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67
# 2. collect all txs of those swaps
# (this uses bash glob syntax to select all output files of the previous `cryo logs ...` command`)
cryo txs --txs ethereum__logs__*
# 3. collect all traces of those swaps
cryo traces --txs ethereum__logs__*
# 4. collect all state_diffs of those swaps
cryo state_diffs --txs ethereum__logs__*
# directory will now contain these files
# - ethereum__logs__17000000_to_17000999.parquet
# - ethereum__transactions__17000000_to_17000999.parquet
# - ethereum__traces__17000000_to_17000999.parquet
# - ethereum__balance_diffs__17000000_to_17000999.parquet
# - ethereum__code_diffs__17000000_to_17000999.parquet
# - ethereum__nonce_diffs__17000000_to_17000999.parquet
# - ethereum__storage_diffs__17000000_to_17000999.parquet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment