[
  {
    "path": ".contract-addrs",
    "content": "export MULTICALL_CONTRACT_ADDR=0xcA11bde05977b3631167028862bE2a173976CA11\nexport WORKER_REGISTRATION_CONTRACT_ADDR=0x7Bf0B1ee9767eAc70A857cEbb24b83115093477F\nexport NETWORK_CONTROLLER_CONTRACT_ADDR=0x938026fefC5F2b6d7c1bCC7098A3Fd1A81C2AECF\nexport GATEWAY_REGISTRY_CONTRACT_ADDR=0x01D7D0CC06cDdD744a9E06C9bc5249DA6da3e848\n"
  },
  {
    "path": ".gitignore",
    "content": "/node_modules\n/lib\n/query-gateway/keys/*.key\n/query-gateway/allocations.db\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2023 Subsquid Labs\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "w<p align=\"center\">\n<picture>\n    <source srcset=\"https://uploads-ssl.webflow.com/63b5a9958fccedcf67d716ac/64662df3a5a568fd99e3600c_Squid_Pose_1_White-transparent-slim%201.png\" media=\"(prefers-color-scheme: dark)\">\n    <img src=\"https://uploads-ssl.webflow.com/63b5a9958fccedcf67d716ac/64662df3a5a568fd99e3600c_Squid_Pose_1_White-transparent-slim%201.png\" alt=\"Subsquid Logo\">\n</picture>\n</p>\n\n[![docs.rs](https://docs.rs/leptos/badge.svg)](https://docs.subsquid.io/)\n[![Discord](https://img.shields.io/discord/1031524867910148188?color=%237289DA&label=discord)](https://discord.gg/subsquid)\n\n[Website](https://subsquid.io) | [Docs](https://docs.subsquid.io/) | [Discord](https://discord.gg/subsquid)\n\n[Subsquid Network Docs](https://docs.subsquid.io/subsquid-network/)\n\n# Network Test One: Uniform Load\n\nSome tests of Subsquid Network Phase Two testnet require that all workers regularly serve some queries. You can help the team create this type of uniform load by running this squid.\n\nNote: you'll need to have at least 10 tSQD to complete this quest. Obtain them by doing other quests first.\n\n> [!TIP]\n> If you locked any of your tSQD before, check if you can unlock any at the [gateways page](https://app.subsquid.io/profile/gateways?testnet).\n\n### I. Install dependencies: Node.js, Docker, Git.\n\n<details>\n<summary>On Windows</summary>\n\n1. Enable [Hyper-V](https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v).\n2. Install [Docker for Windows](https://docs.docker.com/desktop/install/windows-install/).\n3. Install NodeJS LTS using the [official installer](https://nodejs.org/en/download).\n4. Install [Git for Windows](https://git-scm.com/download/win).\n\nIn all installs it is OK to leave all the options at their default values. You will need a terminal to complete this tutorial - [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) bash is the preferred option.\n\n</details>\n<details>\n<summary>On Mac</summary>\n\n1. Install [Docker for Mac](https://docs.docker.com/desktop/install/mac-install/).\n2. Install Git using the [installer](https://sourceforge.net/projects/git-osx-installer/) or by [other means](https://git-scm.com/download/mac).\n3. Install NodeJS LTS using the [official installer](https://nodejs.org/en/download).\n\nWe recommend configuring NodeJS to install global packages to a folder owned by an unprivileged account. Create the folder by running\n```bash\nmkdir ~/global-node-packages\n```\nthen configure NodeJS to use it\n```bash\nnpm config set prefix ~/global-node-packages\n```\nMake sure that the folder `~/global-node-packages/bin` is in `PATH`. That allows running globally installed NodeJS executables from any terminal. Here is a one-liner that detects your shell and takes care of setting `PATH`:\n```\nCURSHELL=`ps -hp $$ | awk '{print $5}'`; case `basename $CURSHELL` in 'bash') DEST=\"$HOME/.bash_profile\";; 'zsh') DEST=\"$HOME/.zshenv\";; esac; echo 'export PATH=\"${HOME}/global-node-packages/bin:$PATH\"' >> \"$DEST\"\n```\nAlternatively you can add the following line to `~/.zshenv` (if you are using zsh) or `~/.bash_profile` (if you are using bash) manually:\n```\nexport PATH=\"${HOME}/global-node-packages/bin:$PATH\"\n```\n\nRe-open the terminal to apply the changes.\n\n</details>\n<details>\n<summary>On Linux</summary>\n\nInstall [NodeJS (v16 or newer)](https://nodejs.org/en/download/package-manager), Git and Docker using your distro's package manager.\n\nWe recommend configuring NodeJS to install global packages to a folder owned by an unprivileged account. Create the folder by running\n```bash\nmkdir ~/global-node-packages\n```\nthen configure NodeJS to use it\n```bash\nnpm config set prefix ~/global-node-packages\n```\nMake sure that any executables globally installed by NodeJS are in `PATH`. That allows running them from any terminal. Open the `~/.bashrc` file in a text editor and add the following line at the end:\n```\nexport PATH=\"${HOME}/global-node-packages/bin:$PATH\"\n```\nRe-open the terminal to apply the changes.\n\n</details>\n\n### II. Install Subsquid CLI\n\nOpen a terminal and run\n```bash\nnpm install --global @subsquid/cli@latest\n```\nThis adds the [`sqd` command](https://docs.subsquid.io/squid-cli/). Verify that the installation was successful by running\n```bash\nsqd --version\n```\nA healthy response should look similar to\n```\n@subsquid/cli/2.8.0 linux-x64 node-v20.5.1\n```\n\n### III. Run the squid\n\n1. Open a terminal, navigate to any folder for which you have write permissions and run the following commands to retrieve the squid, enter its folder and install dependencies:\n   ```bash\n   sqd init uniform-load-squid -t https://github.com/subsquid-quests/network-test-one-uniform-load-squid\n   ```\n   ```bash\n   cd uniform-load-squid\n   ```\n   ```bash\n   npm ci\n   ```\n\n> [!IMPORTANT]\n> If you're on Windows, the terminal opens in `C:\\Windows\\system32` by default. Do not download your squid there, navigate someplace else.\n\n2. Press \"Get Key\" button in the quest card to obtain the `networkTestOneUniformLoad.key` key file. Save it to the `./query-gateway/keys` subfolder of the squid folder. The file will be used to identify your local query gateway when locking tSQD to allocate bandwidth and as it operates.\n\n3. Get the peer ID of your future gateway by running:\n   ```bash\n   sqd get-peer-id\n   ```\n\n4. Register your future gateway using [this page](https://app.subsquid.io/profile/gateways/add?testnet).\n   - Use the peer ID you obtained in the previous step.\n   - Leave the \"Publicly available\" switch disabled.\n\n5. Lock 10 tSQD by selecting your gateway on [this page](https://app.subsquid.io/profile/gateways?testnet), clicking \"Get CU\" and submitting the form. Once done, you will begin getting computation units (*CUs*) once every epoch (~15 minutes).\n\n   The \"Lock blocks duration\" field lets you tune the length of time during which you'll be able to query the network, measured in blocks of Arbitrum Sepolia's L1 (that is, Ethereum Sepolia). The minumum is five hours, but you can opt to lock for longer if you intend to work on the quest over multiple days.\n\n   | Time              | Blocks |\n   |:-----------------:|:------:|\n   | 5 hours (minimum) | 1500   |\n   | 24 hours          | 7200   |\n   | 72 hours          | 21600  |\n\n   Be aware that you'll need to unlock your tokens manually after the end of this period. The tokens you get back will be used in subsequent quests.\n\n   If the locking period expires before you finish your work, simply unlock your tokens, then lock them again.\n\n6. Wait for about 15 minutes. This is the time it takes for Subsquid Network to enter a new epoch, at the beginning of which CUs will be allocated towards your gateway.\n\n7. Start the query gateway with\n   ```bash\n   sqd up\n   ```\n\n   If you'd like to check if the locking was successful, you can inspect the logs of the query gateway container with `docker logs <query_gateway_container_name>`. After one-two minutes required for the node startup it should contain some lines like this one:\n   ```\n   [2024-01-31T14:55:06Z INFO  query_gateway::chain_updates] allocated CU: 48300 spent CU: 0\n   ```\n\n> [!TIP]\n>   If you get an error message about `unknown shorthand flag: 'd' in -d`, that means that you're using an old version of `docker` that does not support the `compose` command yet. Update Docker or edit the `commands.json` file as follows:\n>   ```diff\n>            \"up\": {\n>            \"deps\": [\"check-key\"],\n>            \"description\": \"Start a PG database\",\n>   -        \"cmd\": [\"docker\", \"compose\", \"up\", \"-d\"]\n>   +        \"cmd\": [\"docker-compose\", \"up\", \"-d\"]\n>          },\n>          \"down\": {\n>            \"description\": \"Drop a PG database\",\n>   -        \"cmd\": [\"docker\", \"compose\", \"down\"]\n>   +        \"cmd\": [\"docker-compose\", \"down\"]\n>          },\n>   ```\n\n8. Build the squid code\n   ```bash\n   sqd build\n   ```\n\n9. Start your squid with\n   ```bash\n   sqd run .\n   ```\n   The command should output lines like these:\n   ```\n   [eth-processor] {\"level\":2,\"time\":1705681499120,\"ns\":\"sqd:commands\",\"msg\":\"PROCESS:ETH\"}\n   [moonbeam-processor] {\"level\":2,\"time\":1705681499148,\"ns\":\"sqd:commands\",\"msg\":\"PROCESS:MOONBEAM\"}\n   [base-processor] {\"level\":2,\"time\":1705681499155,\"ns\":\"sqd:commands\",\"msg\":\"PROCESS:BASE\"}\n   [bsc-processor] {\"level\":2,\"time\":1705681499163,\"ns\":\"sqd:commands\",\"msg\":\"PROCESS:BSC\"}\n   [eth-processor] 01:24:59 INFO  sqd:processor processing blocks from 955722\n   [base-processor] 01:24:59 INFO  sqd:processor processing blocks from 1208926\n   [moonbeam-processor] 01:24:59 INFO  sqd:processor processing blocks from 166845\n   [bsc-processor] 01:24:59 INFO  sqd:processor processing blocks from 16996735\n   [eth-processor] 01:24:59 INFO  sqd:processor using archive data source\n   [eth-processor] 01:24:59 INFO  sqd:processor prometheus metrics are served at port 34253\n   [base-processor] 01:24:59 INFO  sqd:processor using archive data source\n   [base-processor] 01:24:59 INFO  sqd:processor prometheus metrics are served at port 40205\n   [moonbeam-processor] 01:24:59 INFO  sqd:processor using archive data source\n   [moonbeam-processor] 01:24:59 INFO  sqd:processor prometheus metrics are served at port 33691\n   [bsc-processor] 01:24:59 INFO  sqd:processor using archive data source\n   [bsc-processor] 01:24:59 INFO  sqd:processor prometheus metrics are served at port 41199\n   [moonbeam-processor] 01:25:00 INFO  sqd:processor:mapping Got 0 burn txs and 0 USDT transfers\n   [moonbeam-processor] 01:25:00 INFO  sqd:processor 171971 / 5325985, rate: 3823 blocks/sec, mapping: 2729 blocks/sec, 1364 items/sec, eta: 23m\n   [base-processor] 01:25:00 INFO  sqd:processor:mapping Got 0 burn txs and 0 USDT transfers\n   [base-processor] 01:25:00 INFO  sqd:processor 1477379 / 9442733, rate: 175758 blocks/sec, mapping: 8032 blocks/sec, 1339 items/sec, eta: 45s\n   [base-processor] 01:25:02 INFO  sqd:processor:mapping Got 1 burn txs and 0 USDT transfers\n   ```\n\n   The squid should download enough data in 3-4 hours.\n\n> [!TIP]\n> Do not worry if the squid fails: any progress it made is saved. Simply restart it if it happens.\n\nWhen done, stop the squid processor with Ctrl-C, then stop and remove the query gateway container with\n```bash\nsqd down\n```\n\n10. After the locking period ends, go to the [gateways page](https://app.subsquid.io/profile/gateways/) and unlock your tSQD - you will need them for other quests.\n\n# Quest Info\n\n| Category         | Skill Level                          | Time required (minutes) | Max Participants | Reward                              | Status |\n| ---------------- | ------------------------------------ | ----------------------- | ---------------- | ----------------------------------- | ------ |\n| Squid Deployment | $\\textcolor{green}{\\textsf{Simple}}$ | ~250                    | -                | $\\textcolor{red}{\\textsf{75tSQD}}$  | open   |\n\n# Acceptance critera\n\nSync this squid using the key from the quest card. The syncing progress is tracked by the amount of data the squid has retrieved from [Subsquid Network](https://docs.subsquid.io/subsquid-network).\n\n# About this squid\n\nThis [squid](https://docs.subsquid.io/) retrieves native token burns on ETH, BSC, Base and Moonbeam. It does not keep any data, as it's sole purpose is to stress test the network.\n\nData ingester (\"processor\") code is defined for all networks in `src/testConfig.ts`. The executable `src/main.ts` chooses the settings to use based on its sole command line argument. The scripts file `commands.json` contains commands for running each processor (`process:eth`, `process:bsc`, `process:base` and `process:moonbeam`). You can also use `sqd run` to run all the services at once; the list of services is kept in the [squid manifest](https://docs.subsquid.io/cloud/reference/manifest/) at `squid.yaml`.\n\nThe squid uses Phase Two [Subsquid Network](https://docs.subsquid.io/subsquid-network) as its primary data source.\n\n# Troubleshooting\n\n## Network errors\n\nYour squid may get a variety of errors while trying to connect to your local gateway. Some are completely normal, some indicate problems.\n\n### HTTP 503 and 504\n\nIt is normal to receive a few of this during the sync. If all the responses you get are 503s or 504s and your gateway fails to serve any data, wait for a few hours and retry. The wait is necessary because this behavior can be caused by a network upgrade, which happen frequently - it's a testnet after all.\n\n### HTTP 403\n\nTypically occurs when the computation units (CUs) you should get for locking your tSQD fail to reach the worker nodes of the network. Here's how to approach fixing it:\n\n1. Make sure you waited for 20 minutes since you ran `sqd up` and try running your squid.\n   - You should see no tokens listed as \"Pending lock\" at the [gateways page](https://app.subsquid.io/profile/gateways?testnet). If you still do see some after about 40 minutes of any locking/relocking operations, [contact support](#contacting-support).\n2. If you're still getting 403s, visit the [gateways page](https://app.subsquid.io/profile/gateways?testnet) and ensure that you have some locked tSQD associated with your wallet. To do that, go to your gateway's page and check if the \"Unlock\" button is greyed out.\n   - If it is **NOT**, your locking period had ended. Unlock your tokens, lock them again, restart your gateway with `sqd down` then `sqd up` and go to step 1.\n   - If it is, proceed to step 3.\n3. If you're still getting 403s, attempt the following:\n   - shut your gateway down with `sqd down`\n   - remove `./query-gateway/allocations.db`\n   - start the gateway with `sqd up`\n   - wait for 20 minutes\n   - try running your squid\n4. If you're still getting 403s, attempt the following\n   - shut your gateway down with `sqd down`\n   - remove `./query-gateway/allocations.db`\n   - **unlock your tSQDs** (may take a while)\n   - **lock your tSQDs again**\n   - start the gateway with `sqd up`\n   - wait for 20 minutes\n   - try running your squid\n\n### Connection refused\n\nCan be identified by `ECONNREFUSED` in the squid logs. This means that your query gateway is not running.\n\n1. Check the logs of the gateway container to see if it really isn't running. To get the logs, run `docker logs <query_gateway_container_name>`, where the container name can be found in the output of `sqd up`.\n2. Run `sqd get-peer-id` then [check](https://app.subsquid.io/profile/gateways?testnet) if your gateway is registered. If it is, try re-running `sqd up` and then the quest squid.\n\nAlternatively, shut down all the Docker containers in your system (e.g. by rebooting) and start the quest from scratch.\n\n### Timeouts\n\nTry restarting your gateway container by running `sqd down` then `sqd up`. Then, wait for 20 minutes and try running your squid.\n\n# Contacting support\n\nIf the standard [troubleshooting](#troubleshooting) fails, contact us via [Discord](https://discord.gg/subsquid). Make sure to attach the logs of your query gateway container as a txt file or via [Pastebin](https://pastebin.com). To get the logs, run `docker logs <query_gateway_container_name>`, where the container name can be found in the output of `sqd up`.\n"
  },
  {
    "path": "commands.json",
    "content": "{\n  \"$schema\": \"https://cdn.subsquid.io/schemas/commands.json\",\n  \"commands\": {\n    \"clean\": {\n      \"description\": \"delete all build artifacts\",\n      \"cmd\": [\"npx\", \"--yes\", \"rimraf\", \"lib\"]\n    },\n    \"build\": {\n      \"description\": \"Build the squid project\",\n      \"deps\": [\"clean\"],\n      \"cmd\": [\"tsc\"]\n    },\n    \"check-key\": {\n      \"cmd\": [\"node\", \"scripts/checkKey.js\", \"query-gateway/keys/networkTestOneUniformLoad.key\"],\n      \"hidden\": true\n    },\n    \"get-peer-id\": {\n      \"deps\": [\"check-key\"],\n      \"description\": \"Get a peer ID given the public key\",\n      \"cmd\": [\"node\", \"scripts/getPeerIdFromGatewayKey.js\", \"query-gateway/keys/networkTestOneUniformLoad.key\"]\n    },\n    \"up\": {\n      \"deps\": [\"check-key\"],\n      \"description\": \"Start a Subsquid network gateway\",\n      \"cmd\": [\"docker\", \"compose\", \"up\", \"-d\"]\n    },\n    \"down\": {\n      \"description\": \"Stop a Subsquid network gateway\",\n      \"cmd\": [\"docker\", \"compose\", \"down\"]\n    },\n    \"process:eth\": {\n      \"description\": \"Load .env and start the ETH squid processor\",\n      \"cmd\": [\"node\", \"--require=dotenv/config\", \"lib/main.js\", \"eth\"]\n    },\n    \"process:bsc\": {\n      \"description\": \"Load .env and start the BSC squid processor\",\n      \"cmd\": [\"node\", \"--require=dotenv/config\", \"lib/main.js\", \"bsc\"]\n    },\n    \"process:base\": {\n      \"description\": \"Load .env and start the Base squid processor\",\n      \"cmd\": [\"node\", \"--require=dotenv/config\", \"lib/main.js\", \"base\"]\n    },\n    \"process:moonbeam\": {\n      \"description\": \"Load .env and start the Base squid processor\",\n      \"cmd\": [\"node\", \"--require=dotenv/config\", \"lib/main.js\", \"moonbeam\"]\n    },\n    \"check-updates\": {\n      \"cmd\": [\"npx\", \"--yes\", \"npm-check-updates\", \"--filter=/subsquid/\", \"--upgrade\"],\n      \"hidden\": true\n    },\n    \"bump\": {\n      \"description\": \"Bump @subsquid packages to the latest versions\",\n      \"deps\": [\"check-updates\"],\n      \"cmd\": [\"npm\", \"i\", \"-f\"]\n    }\n  }\n}\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "version: \"3.8\"\n\nservices:\n  query_gateway:\n    image: subsquid/query-gateway:0.2.8\n    environment:\n      HTTP_LISTEN_ADDR: 0.0.0.0:8000\n      BOOT_NODES: >\n        12D3KooWSRvKpvNbsrGbLXGFZV7GYdcrYNh4W2nipwHHMYikzV58 /dns4/testnet.subsquid.io/tcp/22345,\n        12D3KooWQC9tPzj2ShLn39RFHS5SGbvbP2pEd7bJ61kSW2LwxGSB /dns4/testnet.subsquid.io/tcp/22346,\n        12D3KooWQER7HEpwsvqSzqzaiV36d3Bn6DZrnwEunnzS76pgZkMU /dns4/testnet.subsquid.io/tcp/32345\n      RPC_URL: https://sepolia-rollup.arbitrum.io/rpc\n      CONFIG_PATH: /app/data/config/gateway-config.yml\n      KEY_PATH: /app/data/keys/networkTestOneUniformLoad.key\n      ALLOCATIONS_DB_PATH: /app/data/allocations.db\n    env_file:\n      - .contract-addrs\n    volumes:\n      - ./query-gateway:/app/data\n    ports:\n      - \"19174:8000\"\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"squid-evm-template\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"rm -rf lib && tsc\"\n  },\n  \"dependencies\": {\n    \"@belopash/mock-store\": \"^0.0.0\",\n    \"@subsquid/evm-processor\": \"^1.13.0\",\n    \"dotenv\": \"^16.3.1\",\n    \"@inquirer/input\": \"^1.2.14\",\n    \"@inquirer/password\": \"^1.1.14\",\n    \"@types/node\": \"^20.11.5\",\n    \"ethereumjs-wallet\": \"^1.0.2\",\n    \"libp2p\": \"0.32.5\",\n    \"peer-id\": \"^0.16.0\",\n    \"typescript\": \"~5.3.3\"\n  }\n}\n"
  },
  {
    "path": "query-gateway/config/gateway-config.yml",
    "content": "scheduler_id: \"12D3KooWQER7HEpwsvqSzqzaiV36d3Bn6DZrnwEunnzS76pgZkMU\"\nsend_metrics: true\nworker_inactive_threshold_sec: 60\nworker_greylist_time_sec: 600\ndefault_query_timeout_sec: 60\nsummary_print_interval_sec: 30\nworkers_update_interval_sec: 60\navailable_datasets:\n  ethereum-mainnet: \"czM6Ly9ldGhlcmV1bS1tYWlubmV0LTE\"\n  binance-mainnet: \"czM6Ly9ic2MtbWFpbm5ldC0x\"\n  base-mainnet: \"czM6Ly9iYXNlLTE\"\n  moonbeam-mainnet: \"czM6Ly9tb29uYmVhbS1ldm0tMQ\"\n"
  },
  {
    "path": "query-gateway/keys/.keep",
    "content": ""
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"extends\": [\n    \"config:base\"\n  ],\n  \"packageRules\": [\n    {\n      \"groupName\": \"@subsquid\",\n      \"matchPackagePatterns\": [\n        \"^@subsquid/\"\n      ],\n      \"matchUpdateTypes\": [\n        \"minor\",\n        \"patch\",\n        \"pin\",\n        \"digest\"\n      ]\n    },\n    {\n      \"matchPackagePatterns\": [\"*\"],\n      \"excludePackagePatterns\": [\"^@subsquid/\"],\n      \"enabled\": false\n    } \n  ],\n  \"automerge\": true,\n  \"automergeType\": \"pr\",\n  \"automergeStrategy\": \"squash\",\n  \"ignoreTests\": true\n}"
  },
  {
    "path": "schema.graphql",
    "content": "type Transfer @entity {\n  id: ID!\n  network: String! @index\n  block: Int! @index\n  timestamp: DateTime! @index\n  from: String! @index\n  to: String! @index\n  value: BigInt!\n  txHash: String! @index\n}\n"
  },
  {
    "path": "scripts/checkKey.js",
    "content": "import fs from 'fs'\nconst keyPath = process.argv[2]\nif (!keyPath || !fs.existsSync(keyPath) || !fs.lstatSync(keyPath).isFile()) {\n\tconsole.error(`ERROR: Key file not found at ${keyPath}`)\n\tprocess.exit(1)\n}\n"
  },
  {
    "path": "scripts/exportWalletKeyAsJson.js",
    "content": "import fs from 'fs'\nimport wallet from 'ethereumjs-wallet'\n\nconst pk = new Buffer.from(process.argv[2], 'hex') // supply a private key\nconst account = wallet.fromPrivateKey(pk)\nconst password = process.argv[3] // will be required to unlock/sign after importing\n\naccount.toV3(password)\n\t.then(value => {\n\t\tconst address = account.getAddress().toString('hex')\n\t\tconst file = `UTC--${new Date().toISOString().replace(/[:]/g, '-')}--${address}.json`\n\t\tfs.writeFileSync(file, JSON.stringify(value))\n\t})\n"
  },
  {
    "path": "scripts/getPeerIdFromGatewayKey.js",
    "content": "import { createFromPrivKey } from 'peer-id'\nimport { keys } from 'libp2p-crypto'\nimport { readFileSync } from 'fs'\n\nconst file = readFileSync(process.argv[2])\n\nasync function main() {\n\tconst key =  await keys.supportedKeys.ed25519.unmarshalEd25519PrivateKey((file))\n\tconst peerId = await createFromPrivKey(key.bytes)\n\tconsole.log('Your peer ID is', peerId.toB58String())\n}\n\nmain()\n"
  },
  {
    "path": "scripts/package.json",
    "content": "{\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "squid.yaml",
    "content": "manifestVersion: subsquid.io/v0.1\nname: uniform-load-squid\nversion: 1\ndescription: Quest squid for loading the Phase 2 permissionless Subsquid testnet\nbuild: \ndeploy:\n  processor:\n    - name: eth-processor\n      cmd:\n        - sqd\n        - process:eth\n    - name: bsc-processor\n      cmd:\n        - sqd\n        - process:bsc\n    - name: base-processor\n      cmd:\n        - sqd\n        - process:base\n    - name: moonbeam-processor\n      cmd:\n        - sqd\n        - process:moonbeam\n"
  },
  {
    "path": "src/allFields.ts",
    "content": "// evm-processor fields selections for all existing fields\n\nexport const allTransactionFields = {\n\tgas: true,\n\tgasPrice: true,\n\tmaxFeePerGas: true,\n\tmaxPriorityFeePerGas: true,\n\tinput: true,\n\tnonce: true,\n\tvalue: true,\n\tv: true,\n\tr: true,\n\ts: true,\n\tyParity: true,\n\tchainId: true,\n\tgasUsed: true,\n\tcumulativeGasUsed: true,\n\teffectiveGasPrice: true,\n\tcontractAddress: true,\n\ttype: true,\n\tstatus: true,\n\tsighash: true\n}\n\nexport const allLogFields = {\n\ttransactionHash: true\n}\n\nexport const allTraceFields = {\n\tcreateFrom: true,\n\tcreateValue: true,\n\tcreateGas: true,\n\tcreateInit: true,\n\tcreateResultGasUsed: true,\n\tcreateResultCode: true,\n\tcreateResultAddress: true,\n\tcallFrom: true,\n\tcallTo: true,\n\tcallValue: true,\n\tcallGas: true,\n\tcallSighash: true,\n\tcallInput: true,\n\tcallResultGasUsed: true,\n\tcallResultOutput: true,\n\tsuicideAddress: true,\n\tsuicideRefundAddress: true,\n\tsuicideBalance: true,\n\trewardAuthor: true,\n\trewardValue: true,\n\trewardType: true\n}\n\nexport const allStateDiffFields = {}\n\nexport const allBlockHeaderFields = {\n\tnonce: true,\n\tsha3Uncles: true,\n\tlogsBloom: true,\n\ttransactionsRoot: true,\n\tstateRoot: true,\n\treceiptsRoot: true,\n\tmixHash: true,\n\tminer: true,\n\tdifficulty: true,\n\ttotalDifficulty: true,\n\textraData: true,\n\tsize: true,\n\tgasLimit: true,\n\tgasUsed: true,\n\tbaseFeePerGas: true\n}\n\nexport const allFields = {\n\ttransaction: allTransactionFields,\n\tlog: allLogFields,\n\ttrace: allTraceFields,\n\tstateDiff: allStateDiffFields,\n\tblock: allBlockHeaderFields\n}"
  },
  {
    "path": "src/main.ts",
    "content": "import {MockDatabase} from '@belopash/mock-store'\nimport {processor, config} from './processor'\n\nprocessor.run(new MockDatabase(), config.batchHandler)\n"
  },
  {
    "path": "src/processor.ts",
    "content": "import assert from 'assert'\nimport {EvmBatchProcessor} from '@subsquid/evm-processor'\nimport {networksConfig} from './testConfig'\n\nassert(Object.keys(networksConfig).includes(process.argv[2]), `no config for network \"${process.argv[2]}\"`)\nexport const config = networksConfig[process.argv[2] as keyof typeof networksConfig]\n\nconst processor = new EvmBatchProcessor().setGateway(config.datasetUrl)\n\nif (config.range) processor.setBlockRange(config.range)\nif (config.includeAllBlocks) processor.includeAllBlocks()\nfor (let txRequest of config.transactions) {\n    processor.addTransaction(txRequest)\n}\nfor (let logRequest of config.logs) {\n    processor.addLog(logRequest)\n}\nfor (let traceRequest of config.traces) {\n    processor.addTrace(traceRequest)\n}\nfor (let stateDiffRequest of config.stateDiffs) {\n    processor.addStateDiff(stateDiffRequest)\n}\nprocessor.setFields(config.fields)\n\nexport { processor }\n"
  },
  {
    "path": "src/testConfig.ts",
    "content": "import {assertNotNull} from '@subsquid/util-internal'\n\nimport {allTransactionFields, allBlockHeaderFields} from './allFields'\nimport {getRandomInt} from './utils'\n\nconst gateway = assertNotNull(process.env.SUBSQUID_NETWORK_GATEWAY)\n\nconst commonConfig = {\n    batchHandler: async (ctx: any) => {\n        let burns = 0\n        for (let block of ctx.blocks) {\n            burns += block.transactions.length\n        }\n        ctx.log.info(`Got ${burns} burn txs`)\n    },\n    includeAllBlocks: true,\n    transactions: [\n        {\n            to: ['0x0000000000000000000000000000000000000000']\n        }\n    ],\n    logs: [],\n    traces: [],\n    stateDiffs: [],\n    fields: {\n        transaction: allTransactionFields,\n        block: allBlockHeaderFields\n    }\n}\n\nexport const networksConfig = {\n    eth: {\n        datasetUrl: `${gateway}/network/ethereum-mainnet`,\n        range: { from: getRandomInt(0, 14_000_000) },\n        ...commonConfig\n    },\n    bsc: {\n        datasetUrl: `${gateway}/network/binance-mainnet`,\n        range: { from: getRandomInt(0, 30_000_000) },\n        ...commonConfig\n    },\n    base: {\n        datasetUrl: `${gateway}/network/base-mainnet`,\n        range: { from: getRandomInt(0, 4_000_000) },\n        ...commonConfig\n    },\n    moonbeam: {\n        datasetUrl: `${gateway}/network/moonbeam-mainnet`,\n        range: { from: 0 },\n        ...commonConfig\n    }\n}\n"
  },
  {
    "path": "src/utils.ts",
    "content": "export function getRandomInt(min: number, max: number) {\n    return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"target\": \"es2020\",\n    \"outDir\": \"lib\",\n    \"rootDir\": \"src\",\n    \"strict\": true,\n    \"declaration\": false,\n    \"sourceMap\": true,\n    \"esModuleInterop\": true,\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true,\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true\n  },\n  \"include\": [\"src\"],\n  \"exclude\": [\n    \"node_modules\"\n  ]\n}\n"
  }
]