Add onchain/script/backtesting/fetch-events.ts — a tsx script that: - Fetches Swap/Mint/Burn events from a Uniswap V3 pool via Infura (Base mainnet) - Batches eth_getLogs in 2 000-block chunks with 100 ms inter-batch delay - Decodes each log with viem and writes one JSON Line per event - Supports resume: reads last block from existing cache file on re-run - Retries with exponential back-off on 429 / rate-limit errors - Prints per-batch progress: "Fetching blocks X-Y... N events (B/T batches)" Also adds package.json, tsconfig.json, and cache/.gitkeep. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
52411e881a
commit
df89b8c2da
4 changed files with 330 additions and 0 deletions
16
onchain/script/backtesting/package.json
Normal file
16
onchain/script/backtesting/package.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "backtesting",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"fetch": "tsx fetch-events.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"viem": "^2.22.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.0",
|
||||
"tsx": "^4.19.0",
|
||||
"typescript": "^5.7.0"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue